Resize in S3 upload action

Hopefully must last plea related to the long saga of getting to grips with Docker/ S3 uploads etc. Thanks to @George for his untiring assistance and patience and to @Emiel for yesterdays assistance which was invaluable

My last problem (i hope) is using resize image with uploaded images

Obviously a normal upload / resize action would be something like

image

With S3 / Put image i have tried various combinations, variations of this

image

But there is obviously some sort of disjoint in the paths between save (should; that even be necessary?) as the image is always saved as per the original

Probably really simple but I just cant get this working. Images upload to correct location on D.O. spaces but are not resized

Anyone point me in the right direction?

Hi @Hyperbytes,

couldn’t you do the resize stuff in a temp directory and upload it to S3 after that?

Thanks, I can try that but is that the best way? Seems a bit disjointed.

1 Like

I m supposing (but I m not a professional nor an expert) that S3 Storage is a static deposit where you can store only a file. If you want to modify it you must download it (or bring it back to your server) do what you want and then upload it again.

In S3 storage the same file is saved multiple times to different physical hard drives to guarantee the availability of the file in case of hardware failure.

Maybe I m wrong but according my experience
this is S3.

If you need to work with your files, S3 maybe is not best option, while it is really great option to store files in static way.

I am saving multiple copies of the same uploaded file to different sub directories within the DO space, full size image, mid size (640px wide) and thumb (160px wide) both within development and production directories within then spaces object as appropriate.

Everything is working as it should other than the resize

You must resize the image before upload to S3…

I think you cannot resize an image on S3 directly.

Thanks, that seems a sad waste of server processing time to load / resize /save/ reload / upload but if that is what needs to be done then so be it. Thanks for all for the assistance

Still cant get this to work, anyone give me an example of how to re-load the image once resized and pass it to S3 PUT

Think I have it solved thanks, even bug reports can sometimes be as useful as a “how to”, managed to work it out from one

1 Like

How you solved?
Do you makes GET file each time and the PUT it in S3?

This was the final solution

image

Saved the resized image to a static folder

image

Problems were just getting the paths right on the PUT to get the saved image

image

1 Like

Great thing of Digital Ocean S3 is that CDN service is included!

Yes, already have a dedicated CDN domain in place, works great