class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
In looking at your example code, if I understand you correctly we would need to call the process() function twice if we want to save the file to the server as well as to the database.
First we modify the file and use process($directory) to save the file to the server.
Then, we modify the file again as we did before, and use process() to save the contents of the file to the database as a BLOB.
So we're writing the same code twice (unless of course we create a single function to handle the image modification, and then call that function twice.) Let me know if I understand that correctly.
BTW, the only reason I'm saving the file to the database is because it's part of my masters degree project to compare image retrieval performance between the server and the database. But normally I would never do that in practice.Reply
First we modify the file and use process($directory) to save the file to the server.
Then, we modify the file again as we did before, and use process() to save the contents of the file to the database as a BLOB.
So we're writing the same code twice (unless of course we create a single function to handle the image modification, and then call that function twice.) Let me know if I understand that correctly.
BTW, the only reason I'm saving the file to the database is because it's part of my masters degree project to compare image retrieval performance between the server and the database. But normally I would never do that in practice.