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.

Comments

teradome’s picture

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.

Anonymous’s picture

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.

ben@civicspacelabs.com’s picture

whoops that's me with the fix

robertdouglass’s picture

StatusFileSize
new2.97 KB

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.

robertdouglass’s picture

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.

dandaka’s picture

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") {

Zed Pobre’s picture

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.

tulula’s picture

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

tulula’s picture

Excited - this submission worked perfectly for me!

http://drupal.org/node/14000

Lisa

chx’s picture

Component: Code » image.module

no longer applies

chx’s picture

oh, sorry 4.5 shall be left alone.

sas789’s picture

Category: bug » support

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.

sas789’s picture

Never mind, figured out what all those plusses and minusses mean... :-)

walkah’s picture

this only applies to 4.5

basicmagic.net’s picture

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

walkah’s picture

Status: Needs review » Closed (won't fix)

please upgrade to 4.6