Incorrect behaviour with image.module

vitamin - March 7, 2007 - 16:22
Project:Thickbox
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

When uploading picture that is smaller than 'preview' size defined, image.module do not resize original picture, so the same file is used for 'preview' and 'original' pictures. Same thing with thumbnails - in particular, if original picture dimensions is smaller or equal than defined in image.module, the same single file on disk is used for all three variants. That's why the image_load function returns an array with paths to all three pictures.
So, if we have "Enable for image nodes" box checked, it doesn't work correctly all the time (depending on picture size).

#1

frjo - March 9, 2007 - 16:25
Priority:critical» normal

I unfortunately don't use the image module myself and the script that integrates Thickbox with it is contributed from a user.

Hopefully someone using Thickbox with the image module else will contribute a patch.

#2

duntuk - March 15, 2007 - 19:19

yeah noticed the same problem...

there should be an 'if' statement saying 'if preview is not available, load full'

#3

Vallenwood - June 9, 2007 - 06:21

I don't know whether it's because of a recent update to the image module, but this seems to no longer be true. If you look at the _image_build_derivatives function in image.module, if the original image is smaller than the derivative image, it simply copies the original file to the new filename -- but does NOT just use the same filename. So if the original image is smaller than the preview-size dimensions, it copies "original.jpg" to "original.preview.jpg" (for example), without resizing it, but still at least creating a new file.

Am I right on this? I don't know whether this is a recent change in the image.module or whether I'm somehow missing something, but I don't see the problem.

#4

grendzy - June 17, 2007 - 16:19

seems to no longer be true. If you look at the _image_build_derivatives function in image.module, if the original image is smaller than the derivative image, it simply copies the original file to the new filename

Yes I agree, this is how it works for me (using image 5.x-1.2). I removed the true || bit from thickbox_auto.js and it works as expected now (loads preview images).

#5

drewish - August 22, 2007 - 20:12

this should be fixed in the current -dev version of the image module.

#6

frjo - September 22, 2007 - 18:04
Status:active» fixed

#7

pillarsdotnet - September 30, 2007 - 23:22
Version:5.x-1.x-dev» HEAD
Status:fixed» active

Broken again for image-HEAD. See http://drupal.org/node/179855 for a proposed patch.

#8

pillarsdotnet - October 1, 2007 - 17:38
Version:HEAD» 5.x-1.x-dev
Status:active» needs review

If the patch at see http://drupal.org/node/179855 gets accepted, thickbox would also need to be patched as follows:

--- orig/thickbox/thickbox_auto.js      2007-09-30 03:14:38.000000000 -0400
+++ patched/thickbox/thickbox_auto.js   2007-10-01 12:34:19.000000000 -0400
@@ -37,7 +37,7 @@
      * ATTENTION: Until the derivate Bug (http://drupal.org/node/125610) is fixed,
      * the script should allways use the original picture ("true || ").
      */
-    if (thickbox_derivative == "_original") {
+    if (thickbox_derivative == "_original" || $(this).is('.no-resize')) {
       var href = img.attr("src").replace(".thumbnail", "");
     }
     else {

#9

frjo - August 13, 2008 - 14:51
Status:needs review» closed
 
 

Drupal is a registered trademark of Dries Buytaert.