I'm working on a Laravel API project, let see when you upload a image I change the colors, with a shell script. The api accepts urls so that means I have to save the image in a temp folder so that I can edit it and save it to my S3 filesystem. Is it convenient that I save the temp image in the S3 filesystems or local?
Asked
Active
Viewed 721 times
0
-
Maybe try rephrasing your question. I'm having difficulty understanding what you're trying to do and what you're asking. – wheelmaker Jan 10 '19 at 15:08
-
@wheelmaker Sorry, I changed it. hope you understand it now. – Jur Dekker Jan 10 '19 at 15:20
-
How are you uploading the image? If it's through a form on the front end, isn't it already stored in a local temp file for you? Can you not work with it from there and then upload to S3 after you're done? – wheelmaker Jan 10 '19 at 15:28
-
@wheelmaker The image was sent via a url in the API request like this `" url ":" https://vanijzendoorn.nl/wp-content/uploads/2016/11/new-google-logo-png.png "` – Jur Dekker Jan 10 '19 at 15:49
1 Answers
0
It will likely be much faster to save the image locally in a temp directory to make the changes before storing it on S3. You can use sys_get_temp_dir()
to get a path used for temporary files.
https://secure.php.net/manual/en/function.sys-get-temp-dir.php

wheelmaker
- 2,975
- 2
- 21
- 32
-
Is there a way you can get the file size from url without putting it on the temp folder? – Jur Dekker Jan 10 '19 at 22:00
-
https://stackoverflow.com/questions/2602612/remote-file-size-without-downloading-file – wheelmaker Jan 10 '19 at 22:37