statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

RFE: Get Glide to pre-crop to spec size, focal point? #2365

Open iDGS opened 5 years ago

iDGS commented 5 years ago

Per discussion on Discord re: https://glide.thephpleague.com/1.0/api/crop/#crop-crop

I'd like to be able to crop a 600x600px square image to just it's central 300x300px--cookie-cutter style. (At present all I can do is shrink the full-sized image into the smaller one.)

I'd also like to be able to move that 300x300px to center on--or at least include as much as possible around--the focal point of the image as specified via the CP.

TIA. === from discord, below ===

JackToday at 5:17 PM it only crops to make the ratio you're going for, and then resizes since your image is 600x600, 300x300 is the same but smaller so it resizes AFAIK there is no way to just chunk out the middle 300x300 of a larger image

JSBToday at 5:20 PM could do this https://glide.thephpleague.com/1.0/api/crop/#crop-crop Crop - Glide

iDGSToday at 5:20 PM (drat!) OK. Thx. I'll do it another way.

JSBToday at 5:20 PM width, height, x, y sounds complicated though

JackToday at 5:20 PM https://glide.thephpleague.com/1.0/api/crop/ Crop - Glide we didn't create an interface for that last method it's...weird. and in 3 years, this is the first time it's come up (that I'm aware of).

JSBToday at 5:21 PM hahaha

iDGSToday at 5:24 PM Does "no interface" mean I can't do it from withing {{S}}?

JackToday at 5:24 PM right if you turn secure images off you can make that URL pattern yourself /img/yourimage.jpg?crop=300,300,150,150