born05 / craft-imagehotspots

Image Hotspots fieldtype for Craft CMS
Other
5 stars 3 forks source link

Asset thumbnail size #6

Closed wallacio closed 3 years ago

wallacio commented 3 years ago

I've been trying to work out why selected assets aren't displaying in the hotspot picker, which I've traced to the asset thumbnail request timing out. Now, I know that's in essence a PHP-FPM configuration thing. However, the source image in question is 8000x4000 pixels (it's a flattened, spherical render).

I see from the source that the asset request URL attempts to retrieve the image at full resolution

https://github.com/born05/craft-imagehotspots/blob/b953fa1023b507ae96fb5b1a6f43f09c8f467000/src/templates/_components/field/input.html#L19-L26

...which for this asset results in a URL of /actions/assets/thumb&uid=xxx&width=8000&height=4000&v=vvv

This might be a stupid question but is it necessary to request a thumbnail of the image for the hotspot picker at full resolution, if the markers are only storing x and y as percentages of width/height? If it's possible to set a sensible maximum(s) for the thumbnail image request, that would really help. Or if full-res is necessary, don't request a thumbnail.

roelvanhintum commented 3 years ago

Hi @wallacio, thanks for the question! That isn't a stupid question at all. The thumbnail is needed in case of private volumes #5. The full resolution is not needed. I'll look into this somewhere today.

roelvanhintum commented 3 years ago

Update: turns out the size of the popup is variable, which is why the original asset size is used (not limiting popup size). I could max it to something like 2k (i think 1024 is too small). @nielwijers any thoughts on this?

wallacio commented 3 years ago

I guess it depends if there's a maximum size applied to the modal window but I'd have thought 1920x1080 was a sensible maximum. Interestingly, this adds further weight to my FR #3 !

roelvanhintum commented 3 years ago

1.2.0 has a limit of 2048 pixels.