Hi folks...
I know that this topic was discussed maybe 1 million times here but I still have problems with the handling of images.
Until now, I am able to upload an image and store it in the database.Now my provider offers me the use of ImageMagick, so what I would like to do is to change the resolution and the size before the image is saved in the database. I know that the change of an image -on the fly- with ImageMagic needs probably only 1-2 lines in php, so maybe someone knows the solution 🙂 ?
Here's my code to upload and save the image, where do I need to add this line(s)?
------SNIP-------------------
if ($submit)
{
MYSQL_CONNECT("", "USER", "PASS");
mysql_select_db("database");
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
$result=MYSQL_QUERY("INSERT INTO binary_data (description,bin_data,filename,filesize,filetype) ".
"VALUES ('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')");
} else
{
// else show the form to submit new data:
;};
?>
<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
File Description:<br>
<input type="text" name="form_description" size="40">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
<br>File to upload/store in database:<br>
<input type="file" name="form_data" size="40">
<p><input type="submit" name="submit" value="submit">
</form>
------SNAP-------------------
THX