|
PHP- resize pic before insert into MySQL? -
December 13th, 2007
I've learned to upload and insert a pic into my MySQL database, yet I would like to ALSO resize this pic as a thumb (say 100w by 75h pxls) and save the thumb in another table in MySQL at the same time. Does anyone know or have info on how to resize it before I insert it into database?
here is my code so far for uploading the pic:
<?php
$picid= $_POST['picid'];
$Picture = $_FILES['picture']['tmp_name'];
$Picture = file_get_contents($_FILES['picture']['tmp_name']);
$Picture = addslashes($Picture);
$query2 = "INSERT INTO pictures (picid, picture) " .
"VALUES ('$picid', '$Picture')";
$result2 = mysql_query($query2) or die('Sorry, we could not
post your picture to the database at this time');
?>
|