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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vlooivlerke’s picture

What 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.

anrikun’s picture

@JaceRider: Please read the project page about this (the Important! title)
Does it answer your question?

JaceRider’s picture

Makes 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.

anrikun’s picture

Could you please turn this into a feature request (updating title too) so that I add a link to this issue in the Todo list?

JaceRider’s picture

Title: Love it -- but confusing results... » Maintain crop while keeping focused area as visible as possible
Category: support » feature

Converted this to a feature request and updated title accordingly.

vlooivlerke’s picture

I 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 %

JaceRider’s picture

Status: Active » Needs review
FileSize
1.69 KB

I 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.

JaceRider’s picture

FileSize
1.74 KB

New patch -- something strange happened with spacing on the last patch. Here's one that has been properly formatted. Wow... apparently it happened again.

JaceRider’s picture

FileSize
1.78 KB

One last try and then I quit! :)

anrikun’s picture

Is patch at #9 ready to review?

JaceRider’s picture

It is. I apologize for the duplicate postings.

Funksmaname’s picture

Hey 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!

sunshinee’s picture

Great 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!

Funksmaname’s picture

I 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!

DamienMcKenna’s picture

Version: 6.x-1.1 » 7.x-1.x-dev
Issue summary: View changes
FileSize
1.51 KB

Rerolled against v7, though untested.