somehow-digital / typo3-media-processing

"Media Processing" for TYPO3 integrates various image processing libraries and SaaS cloud services into TYPO3 by leveraging their APIs to process images.
https://somehow.digital
GNU General Public License v3.0
6 stars 1 forks source link

Advanced cropping with custom focus point on imagekit #6

Closed fgerards closed 1 year ago

fgerards commented 1 year ago

Another aspect that struck me while trying out the extension with imagekit.io:

if you have a custom focus point / crop-area and want imagekit.io to do the transformation, you have to deliver the custom crop area coordinates via the API in a POST payload. Also, you have to prefix the transformation parameters in zhe URL segment (the default communication method of the extension) with „tr:“

thasmo commented 1 year ago

Indeed, I'm not sure what I did when implementing this. 😅

This is fixed and will be released with version 0.3.2 soon. (On top, URL signing for imagekit.io was also added. 🥳)

thasmo commented 1 year ago

Version 0.3.2 has been released and contains a fix for this.

fgerards commented 1 year ago

hi, you already did an awesome job releasing this extension, thx for that :). As many clients on bigger websites ask for CDN and fast image processing. I will try out the 0.3.2 and give you feedback :)

thasmo commented 1 year ago

@fgerards, thanks! :)

Feel free to keep giving feedback, really appreciate it!

fgerards commented 1 year ago

hi there @thasmo ,

i tested it and a signed url produced by 0.3.2 now is https://ik.imagekit.io/voc6qgmbnw/tr:cm-extract,w-1994,h-660,x-2,y-154:c-at_max,w-870,h-//fileadmin/Allgemeines_Bildmaterial/Header_Bilder/Header_baramundi_UEM.png?ik-t=1716897858&ik-s=97e0a5424534ee2c00f2139ec5b815a862e98690 - it seems like duplicate "w" and "h" attribute (the doubleslash results in my source path simply being "/").

fgerards commented 1 year ago

btw., i also tested it in V11.5 (with php 8.1) and i dont know this is v11 related: if you choose a category name with a dot in it in ext_conf_template.txt (like # cat=imagekit.io), then the tab in the "settings" module is empty

thasmo commented 1 year ago

i tested it and a signed url produced by 0.3.2 now is https://ik.imagekit.io/voc6qgmbnw/tr:cm-extract,w-1994,h-660,x-2,y-154:c-at_max,w-870,h-//fileadmin/Allgemeines_Bildmaterial/Header_Bilder/Header_baramundi_UEM.png?ik-t=1716897858&ik-s=97e0a5424534ee2c00f2139ec5b815a862e98690 - it seems like duplicate "w" and "h" attribute (the doubleslash results in my source path simply being "/").

Attributes are fine in this case as they do refer to different operations. The first operation (cm-extract,w-1994,h-660,x-2,y-154) defines image cropping of the original image, the second operation (c-at_max,w-870) defines image scaling/sizing of the cropped image - it is a transformation chain.

For the double slash; the value of Origin Host URL (imagekit.io.integration.imagekit.source_uri [string]) should be the complete hostname URL (https://website.com/) or left empty, which will set the hostnameto the request hostname. It is not intended to be set to a slash (/) or a path, for now. In the future it probably should handle both including a base URL defining hostname and path.

In the future it would be nice to validate the settings' values and have a better documentation for them as well.

Btw. I've commited a change which should get rid of the empty h- parameter in a future release.

Thanks!

thasmo commented 1 year ago

In addition I've commited a change which will trim leading/trailing slashes from the source URL, so this should at least enable your use case for now. Release still pending.

thasmo commented 1 year ago

@fgerards, version 0.3.3 has been released and should fix the issues you mentioned.

fgerards commented 1 year ago

thx all lot - all working as promised :D