Customizing Image URLs with AWS Serverless Image Handle
SuhatAkbulak opened this issue · 4 comments
I need to integrate an AWS Serverless Image Handler to optimize my images. However, I want the URL of my images for optimization to be like this: https://xxxx.cloudfront.net/model_1/img.jpg instead of using the Thumbor filter like https://xxxx.cloudfront.net/fit-in/150x150/img.jpg. I want to create a predefined template with the modifications I desire. Is this possible?
The main reason for my request is to add a watermark to the images. I don't consider using Base64 for this purpose secure (as watermarks can be easily removed).
I have thought of a few solutions:
*NGINX Reverse Proxy (I'm hesitant because it might create cache problems).
*Editing the serverless-image-handler (custom-v6.2.5) (The index.handler function, but the code is too large to work in the AWS editor. When I download and edit the file and then upload it, it gives errors again.)
I tried encoding the URL, but it's not suitable for me. What I want is to include my model in the URL.
Hi @SuhatAkbulak,
You could likely make this happen on a non scalable basis with the REWRITE_MATCH_PATTERN and REWRITE_SUBSTITUTION env variables, setting your match pattern to match against model_1 and replace it with whatever you need, or having it add the watermark to every image that comes through, though those regexes would be applied against all images.
Otherwise, you could try cloning the repository, making your changes, and using cdk deploy
(more info in the readme), to deploy the stack.
Let me know how it goes,
Simon
Hi @SuhatAkbulak,
Looks like you may not have your environment setup or your account bootstrapped. You can try following these instructions to help get your environment setup.
Let me know how it goes,
Simon
Is there a way to build only the 'image-handler' folder and update it as a zip in Lambda? I currently have an environment set up.