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

teradome - December 3, 2004 - 18:57

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

Anonymous - December 10, 2004 - 22:27

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

ben@civicspacel... - December 10, 2004 - 23:45

whoops that's me with the fix

#4

robertDouglass - January 17, 2005 - 11:53

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.

AttachmentSize
image.module.original_resolution.patch2.97 KB

#5

robertDouglass - January 17, 2005 - 12:55

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

genie - February 5, 2005 - 23:02

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

Zed Pobre - February 19, 2005 - 17:43

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

tulula - March 10, 2005 - 03:44

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

tulula - March 10, 2005 - 04:10

Excited - this submission worked perfectly for me!

http://drupal.org/node/14000

Lisa

#10

chx - March 24, 2005 - 09:12
Component:Code» image.module

no longer applies

#11

chx - March 24, 2005 - 09:12

oh, sorry 4.5 shall be left alone.

#12

sas789 - April 7, 2005 - 14:20
Category:bug report» support request

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

sas789 - April 7, 2005 - 15:05

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

#14

walkah - April 7, 2005 - 15:24

this only applies to 4.5

#15

BASICMAGIC - April 28, 2005 - 22:31

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

walkah - November 29, 2005 - 16:43
Status:patch (code needs review)» won't fix

please upgrade to 4.6

 
 

Drupal is a registered trademark of Dries Buytaert.