• When the ratio of a picture is neither 4:3 nor 3:4 the picture upload function on the “write post/write page” pages scales the thumbnail badly. It just looks really crappy.

    I have a workaround suggestion for those who want to use different ratios (i.e., not only 4×3 and 3×4) in their posts but still have nicely scaled thumbnails.

    Two simple changes are necessary in two files. Don’t forget to backup!

    In function “get_udims()” in “admin-functions.php” on line 1866 change “4 / 3” to “1” (without quotes).

    Do the same thing in “inline-uploading.php” on line 82. You can’t screw anything up as these are the only appearances of “4 / 3” in both files.

    Hopefully, I haven’t overlooked a better solution.

    Mathias

Viewing 4 replies - 1 through 4 (of 4 total)
  • There’s also a line of code in inline-uploading.php that reads:

    if ( $imagedata[‘width’] * $imagedata[‘height’] < 3 * 1024 * 1024 ) {

    In pseudocode, this might read “if the image is more than 3.2 megapixels, then create a thumbnail.” As I was experimenting with the inline uploads, I noticed that none of my digital camera pictures were getting thumbnails. I assume that the limit on the source picture size is to reduce server processing load (it’s probably not reasonable for the server running WP to need to scale down an 8 megapixel JPG). However, since none of the pictures I’ll upload during my upcoming vacation will be more than 3.2 megapixels (that’s my camera’s native resolution), I just added an equal sign so it says this now:

    if ( $imagedata[‘width’] * $imagedata[‘height’] <= 3 * 1024 * 1024 ) {

    I assume you could give it a “4 * 1024 * 1024” if you have a 4 megapixel camera, etc.

    Is this limitation documented?

    Thread Starter mniepert

    (@mniepert)

    I haven’t been able to find anything related. In general, I don’t understand why all these “hard-coded” restrictions exist. There are some PHP contraints as, for example, the “upload_max_filesize” limit [1]. But you could simply check the filesize and compare it to the maximal allowed size… to me, it doesn’t make any sense to put a constraint on the number of pixels.

    Additionally, I would be much happier if there was a possibility to enter the thumbnail dimensions, either as percentage or pixel size, retaining the aspect ratios.

    [1] The PHP manual, Chapter 38. Handling file uploads, http://www.php.net/features.file-upload

    hi there,

    i have done the steps that mattanderson describes two replies up…

    but no luck.

    any ideas?! i’m using a 5 mega pixel camera. but no matter what i use in the line he is referring to it does not work.

    with =< 5 it does not affect it and even if i use < 1 does not give me the desired thumbnails.

    any other bugs known?!

    thanks,
    evert

    hi there once again…

    i’m still puzzeled by above bug.

    if i read the code right as described by mattanderson it says:

    if the picture is smaller than 3*1024*1024 (i.e. 3 megapixels) then go forward with creating a thumbnail, if it is larger, then ignore this part.

    and it seems to work exactly this way. if i upload a picture with less than 1 mega pixel then i get a thumbnail. if i upload pictures from my 5 mega pixel camera i do not have the option for thumbnails.

    so far i have not changed the inline-uploaing file.

    first of all it makes no sense to me that larger pictures are not ‘thumbnailed’… loading time will just increase and the traffic as well. not to mention the cost associated with it…

    having a 5 mega pixel camera and thinking ahead i would like to make sure that any picture is thumbnailed. so first thought is to take out that if sentence and have every picture thumbnailed. but i do not want to mess too much with the code so i followed mattanderson’s example and put a =< 10 in there to ensure that any picture with less than 10 mega pixel gets a thumbnail.

    this is the error message that i get after uploading (and not picture)

    Warning: imagecreatefromjpeg(): ‘/homepages/41/d38948753/htdocs/blog/wordpress/wp-content/uploads/2006/02/PDX12.jpg’ is not a valid JPEG file in /homepages/41/d38948753/htdocs/blog/wordpress/wp-admin/admin-functions.php on line 714

    Warning: Cannot modify header information – headers already sent by (output started at /homepages/41/d38948753/htdocs/blog/wordpress/wp-admin/admin-functions.php:714) in /homepages/41/d38948753/htdocs/blog/wordpress/wp-admin/inline-uploading.php on line 101

    any help is more than welcome!

    evert

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP2.0 – Picture Uploads – Scaling Issues’ is closed to new replies.