Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In the current version (5.x-2.0), within the deprecated scale tool there is an option to select inside or outside dimensions. This is extremely useful for creating square images from non-square images. There's an indication that this feature will be removed in 2.1, and depreciated in favor of the Scale and Crop tool - however, that tool doesn't create square images from non-square images. Is there a method for creating square images in 2.1, while scaling to the outside dimensions? If not, please retain this feature from 2.0.
Comment | File | Size | Author |
---|---|---|---|
#56 | remove-deprecated_275497_56.patch | 555 bytes | SteffenR |
#55 | remove-deprecated_275497_55.patch | 796 bytes | SteffenR |
Comments
Comment #1
erikhopp CreditAttribution: erikhopp commentedI'd like to retain this feature in the next version of imagecache too!
Comment #2
drewish CreditAttribution: drewish commentedi'm not sure what you're talking about. scale and crop will most definitely create square images from non-square images... have you given it a try?
Comment #3
coreyp_1 CreditAttribution: coreyp_1 commentedI'm having the same problem.
Suppose I have an image, 100x200, that I want re-sized to at most 50x50. I don't care how wide or how tall the 50x50 actually is, as long as neither dimension exceeds 50 (and it keeps the same aspect ratio). In this case, the resulting picture should be 25x50. I don't see how to accomplish this without using the "deprecated" inside/outside options.
Comment #4
alexh CreditAttribution: alexh commentedInside/outside dimension feature is very much necessary to scale a mixed set of landscape/portrait images for placing them into a square border (like an slide frame). Please keep it!
Comment #5
Island Usurper CreditAttribution: Island Usurper commentedIt sounds like you just need the new Scale action. Set both dimensions to maximum size that you want. That's equivalent to the Inside option.
I don't know how you would emulate the Outside option, but I don't think it's nearly as useful.
Just so long as there's a good upgrade path, I'll be happy.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commented+1. I'm lost without the Outside option (or a workable alternative).
Comment #7
starbow CreditAttribution: starbow commented+1, I use the Outside scale and the crop center to get a particular square. I don't see any way to get this particular effect from the non-deprecated actions.
Comment #8
droople CreditAttribution: droople commented+1
please keep
Comment #9
HansBKK CreditAttribution: HansBKK commented+1 on preserving some sort of "outside scale" if there are good reasons for dropping the deprecated action
dopry, a UI wording suggestion (unless I've misunderstood the function?)
change
to
Comment #10
Island Usurper CreditAttribution: Island Usurper commentedThe Outside option isn't for making square thumbnails. The new Scale and Crop is perfect for making square thumbnails.
Scaling to the outside dimensions lets you create images that are constrained in one dimension, but the actual geometry of the image determines which dimension is constrained. Really wide images are set to a certain height, but at the same time, really tall images are set to a certain width. It's like Scale and Crop without the crop. And that's different from what the new Scale does.
The slide frame analogy is a good one. The dimensions of the slide are what you would enter, and it would scale the image to completely fill it. But you would still see the entire image when it is displayed.
Comment #11
mindgame CreditAttribution: mindgame commentedScale with inside/outside dimensions was very useful and flexible! I love it!!
Imagine this case: For a table view of applicants you want to have square thumbnails of their photos, but as the face is usually in the upper part of the image I used this preset with imagecache 1.x:
1. "Deprecated" Scale (width: 50, height: 50, fit: Outside dimensions [i.e. no dimension less than 50])
2. Crop (width: 50, height: 50, xoffset: center, yoffset: top [i.e. square from upper middle])
I donate a beer for the first who can tell me how to accomplish exactly the same clipping with only the actions of version 2.1 (excluding my beloved deprecated).
The closest alternative I could find is this:
1. Scale And Crop (width: 50, height: 70 [min. width and min. height])
2. Crop (width: 50, height: 50, xoffset: center, yoffset: top [same as for 1.x])
I have compared the thumbnails from both presets side by side in my table view.
As for the second approach faces are getting a little bigger, but the disadvantage is that for persons too close to the margin the face is cut.
This cannot happen with "Deprecated Scale (outside dimensions)", because when the image format is landscape it takes the full height and for portrait the full width.
My conclusion is that it is good to have one fast action "Scale And Crop", but the Deprecated Scale is very flexible and currently there is no replacement. As the new "Scale" replaces only the "Deprecated Scale (inside dimensions)" why not add an "Outside Scale", so we don't lose that possiblity.
Comment #12
Gabriel R. CreditAttribution: Gabriel R. commentedI am still on 1.x and find the "fit to outside" option very useful too. Now I'm scared of upgrading to 2.x :-)
PS: But I am sure the hope to have the crop from center bug fixed will push me.
Comment #13
crosstopher CreditAttribution: crosstopher commentedFrom my testing, it sounds like everyone's right here, with a nod to HansBKK (#9) who mentions the poor description.
The problem as I see it is that the "Scale and Crop" is improperly described.. it does in fact "preserve aspect ratio" not ignore it, making is the exact replacement for "Outside Scale"+"Crop",.. while the regular "Scale" functions like the old "Inside Scale"..
So go try it despite the bad description before we call keep clamoring for the 'Deprecated Scale'.
Comment #14
HansBKK CreditAttribution: HansBKK commentedCrosstopher,
What you say is true, but doesn't mean the outside scale should be removed.
If the only use for outside scale was to use it in conjunction with crop there would be no need to "undeprecate it". However there are, as Island Usurper points out (#10), those who want the scale without the crop, and thus removing outside scale would be a loss of functionality.
Unless I've missed something, which is entirely possible.
Comment #15
o0MAV0o CreditAttribution: o0MAV0o commentedI've just started playing with this module and found the following preset works to scale any sized image to 100px by 100px
Action ----- Settings
Crop ---------- width: 100, height: 100, xoffset: center, yoffset: center
I'm using this module with Imagefield Gallery.
Comment #16
svilen CreditAttribution: svilen commentedHello
I achieved square thumbnails without ignored aspect ratio with new action
I added to imagecache_actions.inc file this functions
and two things in imagecache.module
new item in imagecache_theme()
and new action in imagecache_imagecache_actions()
Then clear the cache and try the new action
Hope this will be in 2.1 release of this great module
Comment #17
HansBKK CreditAttribution: HansBKK commented@svilen - This thread pretty clearly established that creating square thumbnails is just one aspect of the function being deprecated, and in fact the current option set without the deprecated outside function has no problem satisfying this need.
I don't understand what your code is doing, but please start a new issue for it. I would also suggest trying to clearly explain what problem your code is solving - in other words, why is it needed?
I've reset the wording on this issue back to the main topic of this discussion (as it's evolved), which is asking for all the current "outside crop" functionality to not be discarded with the function marked to be deprecated.
Comment #18
svilen CreditAttribution: svilen commentedI am sorry for the wrong post, i will create a new one explaining the idea of my code
Comment #19
OpenChimp CreditAttribution: OpenChimp commented+1
Just adding my vote to keep the Outside Dimensions feature or something similar. I've always found it very useful (doing basically the same thing as mindgame), and it seems like noone on this thread has a comparable solution for how to create square thumbnails from various sized images using the non deprecated actions.
I hope that this sticks around or that a clear alternative method is provided for creating these type of images.
Thanks
Comment #20
danielb CreditAttribution: danielb commentedSeems to me that the Scale & Crop feature does not at all do what I want, and if the maintainers of this module think it is appropriate for making perfect thumbnails, then they do not understand how flexible this module can be, and just what people have been doing with it.
I have found the Drupal 6 version of image cache quite frustrating - particularly seeing 'deprecated' on the most useful imagecache feature.
I forsee a new module being created called "Imagecache Classic".
Comment #21
HansBKK CreditAttribution: HansBKK commented@danielb - it's not as if the functionality has actually gone away, or the maintainers have marked this "won't fix". The whole idea of this issue is to give information on why this feature should be kept, not to belittle or berate the developers, from whose work we're benefiting solely because of their generosity. Consider the fact that there may be reasons for deprecating this function that we don't yet know about, beyond their failing to consider all possible use cases, and even if not, that's entirely understandable.
Regarding whatever other frustrations you may be experiencing with the module, it might be helpful if you post specific details as a (new and different) support request in the queue. However I would suggest you're more likely to get help (not only from the maintaineres) if you could try to word your request a bit more positively and give more specific concrete details on the issues, ideally with step-by-step instructions on how to re-create what you're seeing.
Comment #22
HansBKK CreditAttribution: HansBKK commentedTo summarize my understanding from the above thread, Scale & Crop will give square thumbnails from non-square photos while maintaining proper aspect ratio, but the deprecated outside dimensions option allows for a better result when you want to keep as much as possible of the original image.
There are other uses for the outside dimensions option, and it would be great if people could post details on those rather than just keeping reiterating the square thumbnails issue; I personally think that's a dead horse that doesn't need any more flogging.
In the meantime, let me reiterate to dopry and drewish, on behalf of the whole community, our enormous gratitude for your and the others' hard work in creating and maintaining this most excellent module.
Comment #23
danielb CreditAttribution: danielb commentedI don't need help mate, just giving a little motivational kick in the backside. It shows I actually care. :D
Comment #24
3goose CreditAttribution: 3goose commentedHere is a non-square example of where i use outside dimension scaling: I am constantly making sets of images that all have the same dimensions (for galleries, carousels, etc.) from original images that have different aspect ratios, including landscape and portrait oriented originals. I first set the exact dimensions i want, scaling to outside dimensions, then i crop to the same dimensions. This way all of my images are the same size, they retain the maximum amount of the photo possible, and never have black lines on the sides because the aspect ratio changed!
I can't see how you could do this without outside dimension scaling. PLEASE DON'T REMOVE THIS VERY USEFUL FEATURE! (Or explain how i can do the same with the other tools.)
Comment #25
benovic CreditAttribution: benovic commentedword.
I would very much like to see a howto for a preset that is capable of returning a 75x75 square without borders for both: 100x400 images and 400x100.
PLEASE post a howto for this without using the deprecated scale method.
Comment #26
NecroHill CreditAttribution: NecroHill commented+1 to keep this feature
Comment #27
papandos CreditAttribution: papandos commented+1. Without cutting of 25% of the image, because "crop width: 75, height: 75, xoffset: center, yoffset: center" cuts 25 sometimes very important pixels of the such small image. And without black empty area.
Moreover: nobody knows the dimensions of the from other users uploaded images. It would be a harmless problem, if the original image is 100x400. What to do, if the image is 2500x500 (or 500x2500) pixels ???
I thought, it can be solved with "crop- rotate 90´- crop - rotate 270´- scale", but no, it doesn't. I've lost more than 5 hours today with testing of all possible combinations. But nothing helpes.
Do the maintainer know, how this should go without deprecated functionality?
Comment #28
mrwendell CreditAttribution: mrwendell commented+1 for keeping outside dimension on the scale (the depreciated Action) indefinitely.
Our user case is for a non-profit magazine's online publishing platform. For the teaser we present the article with a thumbnail of the lead image.
Now the editors are very picky about how the thumbnail is determined and the volunteer staff creating the articles can upload some very odd aspect ratios.
To get around this I first use the outside scale (e.g. 120px minimum outside) then a javascript crop (100 X 100) so the editors can come in play with the thumbnail for hours on end. For some pathological image ratios (e.g. 1000x100) doing any sort of regular scale (i.e. inside dimension) then a square crop will reek havoc (Unless I am missing something here).
Asking people to prepare images properly ahead of time is not possible, I need to correct for as many mistakes server side as possible.
Comment #29
s.Daniel CreditAttribution: s.Daniel commentedIt took me manny hours and half a dozend projects to figure out that "Add Scale And Crop - Resize an image to an exact set of dimensions, ignoring aspect ratio." does not distort the image.
So 1. the help text should be changed and 2. outside ratio is a usefull feature.
Comment #30
drewish CreditAttribution: drewish commentedthe feature won't be removed.
Comment #31
drewish CreditAttribution: drewish commentedComment #32
drewish CreditAttribution: drewish commentedmarked #449246: Should we use the depricated scale action? as a duplicate.
Comment #33
drewish CreditAttribution: drewish commentedOkay so trying to evaluate the best way forward on this. I think we can create a new "Outside scale" action and migrate any Inside scales into the current Scale action. Does that sound right? Or maybe the current Scale becomes Inside Scale?
Comment #34
v1nce CreditAttribution: v1nce commented+1 tagging.
Thanks for keeping this functionality moving forward!
Comment #35
Sutharsan CreditAttribution: Sutharsan commentedI use the current scale as outside scale, stopped using Deprecated Scale and did not use Scale and crop because of the confusing description.
I.m.o the way forward would be to use the current Scale as Outside Scale, add an Inside Scale. The Scale And Crop could be deprecated because is can be replaced by combining Inside/Outside Scale and Crop.
Thanks for keeping the inside scale option!
Comment #36
GuillaumeDuveauI think we can create a new "Outside scale" action and migrate any Inside scales into the current Scale action. Does that sound right? Or maybe the current Scale becomes Inside Scale? Seems the best scenario to me to obtain a thumbnail while keeping the maximum information and using the whole square.
I'd like to point to another scenario that I think has not been mentionned (NOT using the whole square with the image and putting a background) :
- you have an image of unknown dimensions
- you want to create a square thumb of L pixels that englobes the whole picture and put a colored background C
- you need to know which is greater : width or height
- you scale the width or height to L
- you create a new image which is a square of L pixels with the background C
- you add the image centered on the background
=> Is there any way to do this with ImageCache ? Sorry to hijack that issue.
Comment #37
drewish CreditAttribution: drewish commentedwell now that part of imagecache has landed in core (#491456: ImageCache preset API) we really need to get the inside/outside scaling figured out there and then back port it to 6.
Comment #38
drewish CreditAttribution: drewish commentedokay so i think the solution for this is to do a two scale (scale specifying only height, scaling specifying only width) operations and then crop.
Comment #39
tijeika CreditAttribution: tijeika commented+1
Comment #40
Zach Harkey CreditAttribution: Zach Harkey commented+1 for having two scale options. (The need to preserve inside/outside scaling cannot be understated.)
Seems like the easiest thing to do is rename Deprecated Scale to Scale to fit and leave the options as they are.
However, if you really want to break it into two separate actions, what about Scale Longest Side and Scale Shortest Side. These labels are more intuitive than Outside and Inside dimensions, both of which require full descriptions to decode. If it weren't for "Ideal for cropping the result to a square" I would never remember which one I wanted.
Comment #41
GuillaumeDuveau@Zach : "Scale shortest side" would be enough. Say you want a square of X pixels. Scale the shortest side to X in action 1 then crop to X,X from the center in action 2.
It's impossible otherwise. If you start to scale one size, you need the other size to be greater or equal to the first one if you want to get a square in the end.
Comment #42
Island Usurper CreditAttribution: Island Usurper commentedguix, I think Zach meant that those two actions would cover all of the functionality that people want. I doubt that they would be used on the same preset.
(Minor quibble: "shorter" and "longer" are more correct grammatically than "shortest" and "longest" because there are only two sides to talk about, not three or more.)
Scale longer side would be used the way the scale action is usually used: to make an image fit entirely within a set of dimensions. Scale shorter side would be used to completely fill up a space, with some possible overhang on two ends. However, which two ends depends on the aspect ratio of the original image and not whether you specify just a width or height to scale to. Saying it this way ought to explain why they were previously called inside and outside scale, respectively.
This sounds like the most intuitive labels for these two actions. I would recommend keeping the note that Scale shorter side is the one that people want for cropping to squares afterwards.
Comment #43
GuillaumeDuveau@Island Usurper : seems fine like that !
Comment #44
schedal CreditAttribution: schedal commented+1 to keep this feature!!!
Comment #45
jhebel CreditAttribution: jhebel commented+1 to keep this feature.
Comment #46
jacobmn CreditAttribution: jacobmn commentedI have to agree with people asking to keep this. I understand that most of the functionality can be achieved with the new scale and crop option, BUT that leaves out other possibilities that I would still like to be able to use. I do not see this feature as only useful in pre-cropping situations.
For instance, in many cases I want to resize an image (without even cropping it) to fit within a specific set of dimensions. In this example I would use the inside dimension option to ensure that a photo doesn't break out of a pre-sized box - as one would find in many image galleries.
This is the most common example of how I find this feature useful, as I frequently roll my own image galleries using imagefield, imagecache and one or more jquery scripts in combination to achieve different functionality. I find this feature to offer that little extra (necessary) functionality that sometimes people might want to have available.
That said, imagecache offers a lot of options, so maybe I am overlooking one that can achieve the functionality I have just mentioned. Please let me know if I am incorrect on this.
Comment #47
doublejosh CreditAttribution: doublejosh commented+1 for keeping.
Using the outside scale for unknown width and height prior to a crop (regardless of shape) has always been my #1 use for this module. Only bummer was that it did not include an "allow upscaling" which means there is at least one scenario that imagecache still cannot accomplish even if the deprecated scale is left in...
Completely fill a fixed space with an image of unknown dimensions when at least one dimension is smaller than the fixed space.
This is pretty much the standard scenario on the web for avatars besides a nasty stretch or throwing in a background.
Comment #48
sydneyshan CreditAttribution: sydneyshan commented+1 for keeping.
...unless Scale and Crop gets the functionality to specify an X and Y offset/keyword (ie top, center, bottom and left, center, right).
I have just used this Deprecated Scale to scale an image into a square (using Outside dimensions setting), then use Crop to make a landscape image (specifying center, top as X/Y offset values).
This way I can achieve full-frame scale and crop functionality whilest retaining the ability to specify an offset.
Comment #49
rjacobs CreditAttribution: rjacobs commented+1 as well - and to sydneyshan's point.
We currently do the exact same thing as sydneyshan, but for a square thumb (while always maintaining the upper-left corner)
Comment #50
As If CreditAttribution: As If commentedanother +1 for keeping. I just ran into another one of those situations where no other approach gave me what I wanted.
Comment #51
antonisar CreditAttribution: antonisar commented+1 remove 'deprecated' word and leave functionality as is. Even if there was a method to replicate the functionality spending hours to find it is impractical especially for new users (not that I found it...)
Comment #52
WorldFallz CreditAttribution: WorldFallz commented@37
anyone know if this has been taken up for d7 yet or how this might be done in d7?
I hate to waste time on a patch here, when dww is right-- it should be fixed in d7 and whatever that fix is should be backported to this issue.
Comment #53
s.Daniel CreditAttribution: s.Daniel commentedThe option is available in d7 but as far as I understand there is nothing really to fix in D6. Just remove the text about deprecated status to reduce confusion and everyon is happy, right?
Comment #54
drewish CreditAttribution: drewish commentedSomebody roll a patch to take deprecated and i'll commit it.
Comment #55
SteffenRI rolled a patch against 6.x-2.0-beta12 - to clarify the functionality i added a short description and called the action "Exact Scale" ..
Comment #56
SteffenRi rerolled it again - "Scale to fit" is a more suitable name for the action.. sorry for last one..
Comment #57
fizk CreditAttribution: fizk commentedMarking as ImageCache 2.x Todo.