Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

SLIR + Focus Point = Perfect #41

Open
AzrielOmega opened this issue Oct 12, 2016 · 4 comments
Open

SLIR + Focus Point = Perfect #41

AzrielOmega opened this issue Oct 12, 2016 · 4 comments

Comments

@AzrielOmega
Copy link

Problem: SLIR crop with focus point in the center of the image, but if the focus point of the image was in the side or corner of the image, sometimes the cropped image cut off the important part of the image and make it pointless.

Solution: Add the focus point or focus area parameter to url.

I'm working on it but I'm not good with logic so any have suggestion how to do it properly ?

@lencioni
Copy link
Owner

Have you tried the smart cropping feature? It might give you better results.

@AzrielOmega
Copy link
Author

AzrielOmega commented Oct 12, 2016

I don't see a smart cropping feature in the document. Can you please point it out for me?

For example, you have a 1600x200 image and you want to crop to 100x100. You have the markup is like this:
slir/w100-c1x1/

and you have the cropped image of width from 700 to 900 and of height 200 from original image (200x200), and rezise to 100x100. But sadly the focus point of original image is on the right side of the image so the cropped image is out of focus and be a pointless photo.

But now if we add a parameter to point out the focus point of the image in the url, like example:
slir/w100-c1x1-f1300x175/
with 'f' stand for 'focusPoint' so now after some point of mathematics calculation, the getRequest() point out that the program have to cut the cube of width from 1200 to 1500 and the height still 200 from the original image (another 200x200) and resize to 100x100. Now we have the cropped image with the important part of the photo inside it.

(Sorry for my bad English)

@lencioni
Copy link
Owner

lencioni commented Oct 12, 2016

Ah right, it isn't really documented in the readme I guess. I haven't really worked with this code in many years, so I'm having a hard time remembering how it is done, but I think in your config you would want to do set $defaultCropper to SLIR::CROP_CLASS_SMART.

Here's where that option is in the default config, for reference:

/**
* Default crop mode setting to use if crop mode is not specified in the request.
*
* Possible values are:
* SLIR::CROP_CLASS_CENTERED
* SLIR::CROP_CLASS_TOP_CENTERED
* SLIR::CROP_CLASS_SMART
*
* @since 2.0
* @var string
*/
public static $defaultCropper = SLIR::CROP_CLASS_CENTERED;

@AzrielOmega
Copy link
Author

Wow, it make a huge different to the result. Thank you master, for the contribution, helpful and awesome programs you have made.
Wish you luck and have a nice day.

BTW, I still want to try my idea of manual focus point parameter myself, just in case of needed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants