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).

Comments

frjo’s picture

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.

duntuk’s picture

yeah noticed the same problem...

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

Vallenwood’s picture

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.

grendzy’s picture

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).

drewish’s picture

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

frjo’s picture

Status: Active » Fixed
pillarsdotnet’s picture

Version: 5.x-1.x-dev » master
Status: Fixed » Active

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

pillarsdotnet’s picture

Version: master » 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 {
frjo’s picture

Status: Needs review » Closed (fixed)