In image_display() in image.module, I think this section:

        list($width, $height) = explode("x", $v);
        if ($w > $width || $h > $height) {
          // if this image has not been created then create image.

... should look like this:

        list($width, $height) = explode("x", $v);
        if ($w >= $width || $h >= $height) {
          // if this image has not been created then create image.

Let me know if I should submit a formal patch.

Comments

David Hull’s picture

I'm using the 4.5.0 version of the image module, and I agree that the code looks to me like it has a similar problem. Here's my attempt at a patch (I wrapped the patch with the php tag because, unlike code, it respects the whitespace):

--- image.module.orig   Mon Oct 18 22:15:01 2004
+++ image.module        Mon Oct 18 22:15:42 2004
@@ -946,11 +946,11 @@
 
     list($max_width, $max_height) = split('x', variable_get('image_default_max_size', '1024x768'));
 
-    if ($w < $max_width && $h < $max_height) {
+    if ($w <= $max_width && $h <= $max_height) {
 
       foreach (array_reverse($valid_res) as $v) {
         list($width, $height) = explode("x", $v);
-        if ($w > $width || $h > $height) {
+        if ($w >= $width || $h >= $height) {
           // if this image has not been created then create image.
           if (!$node->image_list[$v] || !file_exists($node->image_list[$v]["fname"])) {
             $fname = _image_make_static($node, $v);
Stefan Nagtegaal’s picture

Component: Code » image.module
Status: Needs review » Fixed

Fixed in CVS for ages.

Anonymous’s picture

Status: Fixed » Closed (fixed)