WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Thumbnails are getting a random suffix

[Resolved] Thumbnails are getting a random suffix

  • 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 100×100 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/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author sewpafly
    Member

    @sewpafly

    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}";
    }

    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.

    Plugin Author sewpafly
    Member

    @sewpafly

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Thumbnails are getting a random suffix’ is closed to new replies.