Small images grossly resized into big ones
teradome - December 3, 2004 - 18:49
| Project: | Image |
| Version: | 4.5.x-1.x-dev |
| Component: | image.module |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Description
I want to set a *maximum* size. If it's larger, then resize... and if it's smaller, don't.
I've changed the module to these settings in an attempt to do just this:
Default max image resolution -- 800x600
List of valid resolutions -- (empty)
But this will still take a small, say 200x100, image and enlarge it to 640x480.

#1
P.S. image.module *does* say this under the List of valid resolutions field: "This is a list of resolutions that the image can be displayed at as well as its original size" -- but currently this seems to only mean original if it is larger than 640x480.
#2
Here's a nice fix for this:
administer -> settings -> image
add "original" to the "List of valid resolutions" -- e.g. "original,640x480,800x600,1024x768,1600x1200"
submit
Now "original" will be listed in the "Default image display resolution" -- select it.
submit
why "original" is not listed by default is a mystery to me.
#3
whoops that's me with the fix
#4
I haven't really tested the validity of ben's claim, but here is a patch that includes 'original' as one of the default resolutions.
#5
Hmmm, the problem with this approach (and the patch) is that original and original image then show up (redundantly) in the links for the image.
#6
To delete duplicated link "original" and leave only "original size", replace this:
line 220
if ($node->width > $max_dim[0] || $node->height > $max_dim[1]) {
with this:
if ($node->width > $max_dim[0] || $node->height > $max_dim[1] && $v != "original") {
#7
Doing this seems to leave me with one of two negative conditions: I end up with either all images left at their original size by default (good for small images, bad for large), or all images scaled to a particular resolution by default (good for large images, bad for small). Can anyone explain how to have any images larger than, say, 800x600 resized, and anything smaller left at the original size? The Max Resolution field doesn't seem to do anything.
#8
Any other solutions?
I've tried both solutions on this post and neither control when you open up the node to view it - neither keep it at the original size.
Lisa
#9
Excited - this submission worked perfectly for me!
http://drupal.org/node/14000
Lisa
#10
no longer applies
#11
oh, sorry 4.5 shall be left alone.
#12
Lisa, I checked out the code you recommended, but being a newbie I can't figure out how to install the patch. Could you provide some direction? Thanks much.
#13
Never mind, figured out what all those plusses and minusses mean... :-)
#14
this only applies to 4.5
#15
hey- i love image.module for 4.5.2...
but just wondering if anyone has this working-
what zed was talking about here:
http://drupal.org/node/13867#comment-22136
"Doing this seems to leave me with one of two negative conditions: I end up with either all images left at their original size by default (good for small images, bad for large), or all images scaled to a particular resolution by default (good for large images, bad for small). Can anyone explain how to have any images larger than, say, 800x600 resized, and anything smaller left at the original size?"
1- large images shown at smaller size (max res, say = 800x600)
**works fine**
2- smaller images shown at original size (less than or equal to max res, say =800x600
**how do i make this work?
please advise- this would be the killer final fix to image.module for 4.5.2-
thanks-
vincent
#16
please upgrade to 4.6