WordPress.org

Ready to get started?Download WordPress

Forums

thumbnail size (57 posts)

  1. ergate
    Member
    Posted 8 years ago #

    Is it possible to change the size of the thumbnails that are displayed in the posts.

    I like the new image uploader/manager, and the fact that a page is created for images, and comments can be made for them etc. I would just like the displayed thumbnails to be a little bigger.

  2. draaku
    Member
    Posted 8 years ago #

    I would be interested in this as well.

  3. netmax
    Member
    Posted 8 years ago #

    ... also looking for this

  4. James
    Happiness Engineer
    Posted 8 years ago #

    If you click on the image after dragging it inside the post window, you will see "grab boxes" which allow you to click-and-drag them in order to alter the image's size.

  5. Mark (podz)
    Support Maven
    Posted 8 years ago #

    The resizing like that does not resize the image.
    It simply makes it bigger - which is not resizing.

    Example:
    Upload an image, make it several times the size of the thumbnail. Result is a blurred and pixellated image.

    Look:
    http://www.tamba2.org.uk/wordpress/TestTrack/2006/01/02/pixellated-pulse/

  6. James
    Happiness Engineer
    Posted 8 years ago #

    When you upload the image, click on it while it's in the Upload interface to access the pull-down menu and select "Using Original". If you select that, then the original image will be added to the post, rather than the thumbnail. The image will still drag-and-drop with the thumbnail's size, but it will be much clearer when enlarged.

  7. kashou
    Member
    Posted 8 years ago #

    I don't get any pulldown menu using Firefox 1.5 and I do have javascript enabled. Is there anyone else that is having problems seeing the custom pulldown?

  8. James
    Happiness Engineer
    Posted 8 years ago #

    Oops, I made a mistake in my previous post. I see the pull-down menu when I left-click on the image in the "Browse" tab once it's uploaded. Try that.

  9. ergate
    Member
    Posted 8 years ago #

    I have seen the options that are discussed above, but that doesnt quite answer what I am looking for. The above solution just stretches or scrunches whatever size thumbnail is on the page, in this case 96 pixels high or 128 pixels wide.

    I have dug around and experimented on my own, and I think I have figure out how to change the size of my thumbnail, but it does require changing one document.
    wp-admin / inline-uploading.php
    (At the moment I am using ms notepad so I cannot give you exact line numbers) Starting around line 80/83 you will see
    if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
    if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
    $thumb = wp_create_thumbnail($file, 128);
    elseif ( $imagedata['height'] > 96 )
    $thumb = wp_create_thumbnail($file, 96);

    This seems to be the first instance of what size the images, thumbnails will be. I quickly did a search on the rest of the document and found reference to thumb size of 96 about 5 more times after these two, they are other parameters, css etc that will need to be changed. I also noticed that the width of 128 referenced in close relation to 96. I changed out 96 pixels with 150 and gave it a couple of test uploads and so far so good.

    I am a second rate hack, if somebody who actually knows what they are doing can verify that this will not "break" something etc etc

  10. kashou
    Member
    Posted 8 years ago #

    I have tried left-clicking once the image is in "Browse." My javascript console reports:

    doPopup is not defined
    http://..../wp-admin/inline-uploading.php?action=view&post=#

    I can see the function in that php file, but it's not working for some reason?

  11. thecompjoe
    Member
    Posted 8 years ago #

    In addition to the information ergate has provided, there also seems to be pertinent code in wp-admin/admin-functions.php

    The code that ergate referenced in wp-admin/inline-uploading.php appears to determine the size of the thumbnail file that WP generates, but from what I can tell, does not actually affect the dimension attributes WP uses when inserting the image. For example, changing the code in inline-uploading.php will result in a thumbnail file with larger dimensions on your server, say 256x192, but when browsing and inserting the thumbnail into the post, WP will still apply the code using something like <img src="pic.jpg" width="128" height="96 />. This is where admin-functions.php comes into play.

    Lines 1771-1778 look something like this:

    function wp_shrink_dimensions($width, $height, $wmax = 128, $hmax = 96) {
    if ( $height <= $hmax && $width <= $wmax )
    return array($width, $height);
    elseif ( $width / $height > $wmax / $hmax )
    return array($wmax, (int) ($height / $width * $wmax));
    else
    return array((int) ($width / $height * $hmax), $hmax);
    }

    and lines 1863-1870 look something like this:

    function get_udims($width, $height) {
    if ( $height <= 96 && $width <= 128 )
    return array($width, $height);
    elseif ( $width / $height > 4 / 3 )
    return array(128, (int) ($height / $width * 128));
    else
    return array((int) ($width / $height * 96), 96);
    }

    Now I've tinkered around with it for a while, replacing the 128 and 96 values with larger integers. I have had limited success in which inserted images now appear with their original dimensions; however, when opting to insert thumbnails, the "thumbnails" are also stretched to the larger dimensions of the original, which causes them to be massively pixelated.

    I am by no means up to snuff on PHP and coding in general, so I have a feeling that if someone more knowledgable were to take a look at the source in these files, there is a way to alter the dimension integers appropriately so that original images and thumbnails are displayed with their correct dimensions respectively.

    Hopefully we can get this issue resolved soon.

    I have also contributed to an already-established ticket on Trac that documents this same problem: http://trac.wordpress.org/ticket/2199

  12. Bonnylad
    Member
    Posted 8 years ago #

    Excellent work on this so far, it would be nice to take control of this feature back from WP, as at the moment it is very limiting.

    Will be watching, good luck to those hacking through it.

  13. thecompjoe
    Member
    Posted 8 years ago #

    Over on Trac, ryan has posted a fix for this issue. The original ticket #2199 along with thumb-splint.diff are located at http://trac.wordpress.org/ticket/2199

    The revised inline-uploading.php is listed on Trac as part of changeset 3407: http://trac.wordpress.org/changeset/3407

    I have not yet had a chance to verify that this resolves the issue. I will be posting soon with details of success.

  14. thecompjoe
    Member
    Posted 8 years ago #

    The fix mentioned above seems to do the trick. Thanks to everyone who contributed in getting this resolved quickly.

  15. Nikki
    Member
    Posted 8 years ago #

    I fear I must be missing something. I uploaded the changed inline-uploading.php file and now I get no dimensions at all.

  16. mcarruth
    Member
    Posted 8 years ago #

    The patch didn't fix the problem for me either.

    Try adding this to line 400 of the original inline-uploading.php


    if ( document.getElementById('I'+n).innerHTML == usingoriginal )
    h = h.replace(new RegExp(' (width|height)=".*?"', 'g'), ''); // Drop size constraints

  17. Nikki
    Member
    Posted 8 years ago #

    Mcarruth, that actually fixed the thumbnail dimensions so they show up again, but the original image dimensions still seem to be missing. Are you still having this problem?

  18. mcarruth
    Member
    Posted 8 years ago #

    I must've misunderstood this thread. The problem I was seeing was that a thumbnail sized image was always inserted; regardless of whether I selected "using original" or "using thumbnail". The code I posted strips the width and height attributes from the img tag if "using original" was set in the upload widget. Removing the width/height force the image to be displayed using the image’s original width/height which is what I was not seeing before.

    Isn’t it redundant to include the image’s original dimensions in the img tag? Is this violating XHTML rules or does it not work in your browser?

  19. kashou
    Member
    Posted 8 years ago #

    I am still having a problem with the custom menu on uploaded images. No matter what I do I cannot get it to appear.

    Can anyone assist with my "doPopup - function not defined" error?

  20. Nikki
    Member
    Posted 8 years ago #

    It's not violating XHTML, but it loads the page down while the browser determines the size and that's not friendly to dial-up users. Since my site is composed almost entirely of photographs, I deem it an important issue, as do some others.

    For now, it seems I'll have to be content with adding the height/width by hand.

  21. petit
    Member
    Posted 8 years ago #

    Niki - really so?

    "It's not violating XHTML, but it loads the page down while the browser determines the size and that's not friendly to dial-up users."

    I have the impression that giving the height and width values will allow the browser to reserve space and start presenting the textual parts of the page while getting the image, which would be kind to viewers on low bandwidth.

    W3C says among other things that the height and width attributes are deprecated ( as scaling can be done by CSS ), but that "The height and width attributes give user agents an idea of the size of an image or object so that they may reserve space for it and continue rendering the document while waiting for the image data."

    That is, the attributes can be given and provide a faster rendering of the text based content, but is no longer recommended. Browsers ( user agents ) can select to use them for scaling - most do( I don't recommend this, as it gives an extra load on the client machine and may not be as good as scaling before delivery )

  22. mozkart
    Member
    Posted 8 years ago #

    The new inline-uploading.php works fine with me.
    Thank you everybody for solving that.

  23. johngilgameshca
    Member
    Posted 8 years ago #

    The new inline-uploading.php does NOT work for me, so I've hacked it up a bit to make it do what I want it to do:

    My experience, and my fix, are located here on my blog.

  24. mcarruth
    Member
    Posted 8 years ago #

    @Nikki, the img height/width attributes have no affect on the image download time. The browser will always download the entire full sized src img and scale it so match the provided height/width attributes on the client.

    If you're intention is to speed up page loads you need to create real thumbnails by that I mean resize your picture and upload both the original and the smaller thumbnail version. Of course you will need to reference the thumbnail img on the thumbnail page and the full image on the main page, but your users will love you for doing it.

  25. Nikki
    Member
    Posted 8 years ago #

    I don't use thumbnails, but thanks- I've solved the problems I was having.

  26. remixer
    Member
    Posted 8 years ago #

    I just installed the latestest update 3407 and im getting these.

    --------------------

    Warning: Cannot modify header information - headers already sent by (output started at /usr/home/ec1/blog/htdocs/wp-admin/inline-uploading.php:2) in /usr/home/ec1/blog/htdocs/wp-admin/inline-uploading.php on line 139

    ----------------------

    Does anyone have an idea on how to fix this.

    thanks

  27. cclark
    Member
    Posted 8 years ago #

    With the help from you guys, and a little tinkering, I was able to get my photoblog working perfectly. Thanks fellas!

  28. petit
    Member
    Posted 8 years ago #

    Good for you cclark. Would you please share the concrete steps to your solution, please!?

  29. NotCharlie
    Member
    Posted 8 years ago #

    Something seems to have been done about this problem -
    Ticket #2199: thumb-splint.diff
    http://trac.wordpress.org/attachment/ticket/2199/thumb-splint.diff

    - but I don't understand what to do with this 'thumb-splint' (whatever a 'thumb-splint' is). Could someone please explain?

    many thanks

  30. kos97866
    Member
    Posted 8 years ago #

    I'd be more interested in the first problem as well - namely being able to change the size at which the thumbnails get generated, not inserted into the page.

    The iImage plugin did that great in 1.5.x. During the upload process, you just had to click if you wanted a thumbnail, and you could give it a different maximum side size in pixels for every image.

    So what I'd like to see is the option to create a 266x200, 400x532, or any other size I may want that one time thumbnail, instead of a certain fixed size. (Or at least the option to set the one size easily for my blog-the default is way too small I think.)

    And sure, we could use the originals and the width height tags, but we have thumbnails so people don't have to load the entire pic if they don't want to see it, right?

Topic Closed

This topic has been closed to new replies.

About this Topic