WordPress.org

Forums

Post Thumbnail Editor
[resolved] Thumbnails are getting a random suffix (4 posts)

  1. José Luís
    Member
    Posted 2 years ago #

    Hello,

    After the last update, I've noticed generated thumbnails are getting a random suffix added to them. For example:

    Original image: calvin_lemonade_economics.jpg

    When I generated a 100x100 thumbnail, I expected its name to be calvin_lemonade_economics-100x100.jpg.

    Instead, I got calvin_lemonade_economics-100x100-1363355801.jpg...

    Is this the default behavior?

    Can it be avoided?

    http://wordpress.org/extend/plugins/post-thumbnail-editor/

  2. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    Right now this is the only choice for this behavior. I'll add an option for 2.0.1. If you want to remove this you can edit post-thumbnail-editor/php/functions.php from:

    function pte_generate_filename( $file, $w, $h ){
    	$info         = pathinfo( $file );
    	$ext          = $info['extension'];
    	$name         = wp_basename( $file, ".$ext" );
    	$suffix       = "{$w}x{$h}";
    	$cache_buster = time();
    );
    	return "{$name}-{$suffix}-{$cache_buster}.{$ext}";
    }

    to:

    function pte_generate_filename( $file, $w, $h ){
    	$info         = pathinfo( $file );
    	$ext          = $info['extension'];
    	$name         = wp_basename( $file, ".$ext" );
    	$suffix       = "{$w}x{$h}";
    );
    	return "{$name}-{$suffix}.{$ext}";
    }
  3. José Luís
    Member
    Posted 2 years ago #

    Thanks, @sewpafly,

    I noticed I only had to change one line. From:

    return "{$name}-{$suffix}-{$cache_buster}.{$ext}";

    to:

    return "{$name}-{$suffix}.{$ext}";

    I'll keep this tweaked until next version.

  4. sewpafly
    Member
    Plugin Author

    Posted 2 years ago #

    The latest @ github now has the option to turn this on and off.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic