Props to what looks like the start of a great module. I am getting some strange results while I play with it -- so let me know your thoughts.
Here's my setup:
Imagefield with focus enabled. No minimum size or ratio. I have an imagecache field setup with a "Focus Scale and Crop" at 550x255.
After uploading an image, if I select a region wider than high everything works great. It doesn't matter how wide and how small a height is selected. Image is cropped with my focused region inside the crop. 550x255.
However, if I select an area considerably higher than wide -- the image is cropped to ?x255. It never has a height > 255 -- but the width fluctuates < 550. If I select a small area that's higher than wide, it works just fine. But there is a point where it breaks down and the final image crop looses it's correct width.
Thoughts?
Comment | File | Size | Author |
---|---|---|---|
#15 | imagefield_focus-n1022498-15.patch | 1.51 KB | DamienMcKenna |
#9 | patch.patch | 1.78 KB | JaceRider |
Comments
Comment #1
vlooivlerke CreditAttribution: vlooivlerke commentedWhat I have done is
main image is 600x300 imagechache preset
I set min widthxhight in focus to 300x150 then tick the constrain ratio box
In this way the user is presented with box that constrain itself, so your image will always fit in hight and width.
Love this too.
Comment #2
anrikun CreditAttribution: anrikun commented@JaceRider: Please read the project page about this (the Important! title)
Does it answer your question?
Comment #3
JaceRider CreditAttribution: JaceRider commentedMakes sense. I appreciate the responses.
It might be ideal to have an option where you give priority to the crop dimensions instead of the user's selection while still taking into account the area they selected and trying to center it in the area the user chose as their focus.
It sounds like your TODO has something along these lines already planned... so I'll leave you to it. :) Again, great start to a module.
Comment #4
anrikun CreditAttribution: anrikun commentedCould you please turn this into a feature request (updating title too) so that I add a link to this issue in the Todo list?
Comment #5
JaceRider CreditAttribution: JaceRider commentedConverted this to a feature request and updated title accordingly.
Comment #6
vlooivlerke CreditAttribution: vlooivlerke commentedI thought of having a (%) drop-down list next to the "constrain ratio" tickbox that will give you the option to select the min box ratio size in relation to the image size but never smaller than the original minimum ratio set.
e.g I make a focus box of min dimension 100x100, I then select 95% of Image size,
This will return then a ration of 1:1 and make the box 95% of the uploaded image. So if my uploaded image was 1000x1000 the box will take a focus size of 950x950, but if my image was 100x100 it will select the whole image as a focus. The focus box must always centre itself according to its ration %
Comment #7
JaceRider CreditAttribution: JaceRider commentedI took a whack at this -- you'll probably have a better approach, but I had some free time and a bit of interest to do so. Basically, it just checks to see if any dimensions are smaller than the set crop size and adjusts things accordingly.
I have attached the patch for the latest dev version.
Comment #8
JaceRider CreditAttribution: JaceRider commentedNew patch -- something strange happened with spacing on the last patch. Here's one that has been properly formatted. Wow... apparently it happened again.
Comment #9
JaceRider CreditAttribution: JaceRider commentedOne last try and then I quit! :)
Comment #10
anrikun CreditAttribution: anrikun commentedIs patch at #9 ready to review?
Comment #11
JaceRider CreditAttribution: JaceRider commentedIt is. I apologize for the duplicate postings.
Comment #12
Funksmaname CreditAttribution: Funksmaname commentedHey there,
Patch #9 worked great for me for maintaining the area (with white space)
would LOVE to see an additional tickbox option to magnify smaller images up to fill thumbnail!
(I know quality wouldn't be great but am creating a site for an art gallery with exhibition images back to 2006 where they only have images narrower than my minimum thumb width, so would be good to zoom those based on crop area)
This is a very clever module, thank you!
Comment #13
sunshinee CreditAttribution: sunshinee commentedGreat module!!! I'm running into a similar issue, but need to allow different ratios due to how images are used in various displays. I'm not much of a programmer, so I hope this isn't a stupid question. Would it make sense to make the focus area the equivalent of imagecache's "offset" so that no matter what dimensions/crops are used in a preset, the focus area is given priority?
When I set a focus area now, it excludes other parts of the image, and imagecache produces images that are smaller than the intended size. :-/
Thanks for any help/insight you can offer!
Comment #14
Funksmaname CreditAttribution: Funksmaname commentedI have set the minimum file upload dimensions to the minimum focus size (being the smallest thumbnail size I use for my site) - using focus area, after applying patch #9, makes the image always the right size, but can result in smaller then intended crops if you force a crop setting - generally i leave crop setting blank unless i need very specific cropping, and usually adjusting it down a bit results in a complete thumbnail.
Hope that helps!
Comment #15
DamienMcKennaRerolled against v7, though untested.