Closed (fixed)
Project:
Image
Version:
6.x-1.x-dev
Component:
image.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 Feb 2006 at 23:04 UTC
Updated:
28 Apr 2006 at 12:45 UTC
hey Walkah,
How would you feel about a patch that adds an "exact size" checkbox to each derivative type in admin/settings/image? I've been doing something like this for a number of sites who have specific thumbnail sizes as part of their design, and I've got a pretty good little bit of code that works for making an exact size derivative by cropping where necessary. It's 4.6, but I don't think it would be a lot of work to push this to 4.7.
Would this be appropriate as part of image.module, or would you rather this go as a separate contrib somehow?
Comments
Comment #1
Bèr Kessels commentedI would 1 this for sure.
First of all because this feature will "document" the current undocumented featuerr of somehow flexible resizing
And secondly it will allow, as you state, exact sizes. Cropping is often nice.
Comment #2
Montuelle commentedI imagine when you say "exact size" for derivatives there is also a resize so the crop is either horizontal either vertical but not both.
Then it would be good, when an new image is created, if the user could specify on which side to crop.
A very simple system would be a numeric field with values -1, 0, +1 indicating in wich direction the center should move:
But using percentage (range from -100% to +100%) would not be more complicated to allow more control on the shifting of the derivative compared to the original.
Comment #3
Bèr Kessels commentedWh all that complexity?
It is far easier to say:
* resize untill H or W has the desired value.
* cut frm both sides of the still-too-long-value 50% off
example: setting:100x120
110x440 image > resized to 100x400 > cropped to 100x120 by cutting 140px off each left and right side
400x140 image > resized to 343x120> cropped to by cutting 121px off each bottom and top side
Comment #4
Montuelle commentedI agree with you. What you describe is the way to crop and resize to reach a given "fixed size".
As you mention the "logical" cut is to cut 50% off if still-too-long.
This algorithm is exactly the one that I had in mind in writing the first sequence of my previous post.
What I was trying to suggest (in case a fixed size is imposed by the administrator) was to add a field in
/node/add/imageso that any user can change that default of 50%. For a given image, the user may prefer for example to cut 0% on the left and 100% on the right.I agree this is not a fundamental request. But photographs may just found their thumbnails a bit more aesthetic if they can choose where to cut.
Comment #5
Bèr Kessels commentedMontuelle. that is a lot of cruft and a lot of interface for such a hardcore feature.
I would suggest you add that to a contrib module. With all the hooks and the form_alter we have it should not be hard to achieve.
Comment #6
joshk commentedBerkes: I actually tended to implement the opposite: crop to correct aspect-ratio, then scale to the correct size. Six of one, half dozen of another. There may be some advantages in image quality one way or another, but I agree that keeping it simple is best.
I'm going to implement a contrib module that will enable this on image nodes and user profiles through nodeapi and hook_user. Hopefully it will demonstrate the utility of this function to everyone.
Comment #7
Stefan Nagtegaal commentedThere is an image_exact.modle which does exactly what you guys want it todo..
Comment #8
(not verified) commented