Reply to Re: Inserting modified image into a database

Re: Inserting modified image into a database new!
by Rocket Dog, 15 years, 9 months ago
Well yes, but you can't both insert the file into the database and to the server as a file if you also need to modify the file. Reason being, each time you call process() everything gets reset.

So in my case, I want to convert the image format of the original, then save it on disk and also to the database. Then I want to create a thumbnail version, which I also want to save on disk as well as to the database. So in essence I have 4 processes to go through for each uploaded file:

1) Reformat the file and save it on disk.
2) Reformat the file as in #1, then save it to the database.
3) Resize the file as a thumbnail and save it on disk.
4) Resize the file as in #3 and save it to the database.

I can somewhat reduce the amount of code required by creating function "A" that will handle the image reformatting, and function "B" to handle the image resizing. I can then call on function "A" for steps 1 and 2, and function "B" for steps 3 and 4.

But if I've still got this all wrong, feel free to jump in! And thanks for your quick feedback!Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important