Support » Fixing WordPress » Change default thumbnail size in WP2.0

  • Hey all –
    There has to be a smart way to change that defaut thumbnail size from 96px x 96px right?

    I know this issue has been brought up before, but nothing has come of it – or maybe the solution has yet to be posted.

    trying to generate some discussion here. Lets help each other out!

Viewing 10 replies - 1 through 10 (of 10 total)
  • This seems to be hardcoded in the source. If you want to hack it I changed the file wp-admin/inline-uploading.php at line 84 to:

    if ( $imagedata['width'] > 256 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
    $thumb = wp_create_thumbnail($file, 256);
    elseif ( $imagedata['height'] > 192 )
    $thumb = wp_create_thumbnail($file, 192);

    This leaves the thumbnails in the editor upload window small, but when you “send it to editor” they are twice as big. I haven’t tested this much, but so far seems to work ok.

    So you changed the thumbsize to less 192px from 96px?

    Yes, the original thumbnails were 128×96 (or 96×128), I just doubled it to 256×192. This seems to work fine for me using firefox.

    However using Internet Exporer I still get small images. Under IE, the code that strips the extra size tags from the image when it gets sent to the editor seems to miss the height tag. (you can see this if you click on the HTML button in the editor, every thumbnail will have a height=128 tag) This seems to stem from the line 426 in

    h = h.replace(new RegExp(' (class|title|width|height|id|onclick|onmousedown)=([^\'"][^ ]*)( |/|>)', 'g'), ' $1="$2"$3'); // Enclose
    attribs in quotes

    Which doesn’t quote the attributes. Changing it to this:

    h = h.replace(new RegExp('(class|title|width|height|id|onclick|onmousedown)=([^\'"][^ />]*)', 'g'), '$1="$2"');

    Seemed to make it work.

    Hey there Jim
    Thanks for posting back…

    It makes sense how you have changed it to start formatting larger thumbnails.. but I am confused when you start talking about – using Internet Exporer I still get small images. and (you can see this if you click on the HTML button in the editor, every thumbnail will have a height=128 tag).
    I am looking at things in Firefox at the moment, and when I send an image to the editor, I clearly dont see any code that is constraining my image to a paticular size.
    As I understand it, a thumb of the image gets created when you upload, and that thumb image gets called when you send to editor.
    Here is my test page so far.
    I dont see from the code how that would be any different in IE. Maybe you are talking about the WP upload manager in IE?

    Does anyone have a good idea on how to alter this to simply make all thumbs that are created be the same height (say 150px)?

    hi jim_m, thank you.
    it helped me.
    i just wanted images width = 240px .
    I changed like you did and it’s working fine!
    hugs, from Brazil.

    You can try the Flexible Upload plugin which allows you to resize thumbnails and original images for upload in WP 2.0+
    It works quite well 🙂

    This didn’t work, sigh, but I’m trying the plugin.

    I just installed that plugin and it works like a charm with WP 2.1.2, solving the aforementioned problem. Good job!

    Ditto to the above really, tried the code posted and it didn’t seem to make any difference, tried changing a few other mentions of 128 in the code but again it didn’t seem to make a difference. I think there must be something deep down in the upload code that makes the thumbnail 128 wide early on, and I decided not to spend hours and hours on it.

    Anyway, downloaded the plugin linked to above and it seems to have done the job, and added a few more options too that I would never have coded myself.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Change default thumbnail size in WP2.0’ is closed to new replies.