Hi
I have created a database in mysql and successfully loaded images via php to it.
The images however have to be a limited size otherwise it presents and error message asking for you to reduce the file size before uploading.
Is there anyone who knows of any php script that would enable me to rezise the image file before it reaches the code that inserts it into the database?
The code I have for the uploading of the file is as follows:
<?php
if ($action == "upload") {
// ok, let's get the uploaded data and insert it into the db now
include "open_db.inc";
if (isset($binFile) && $binFile != "none") {
$data = addslashes(fread(fopen($binFile, "r"), filesize($binFile)));
$strheader = addslashes(nl2br($header));
$strDescription = addslashes(nl2br($Description));
$strPrice = addslashes(nl2br($Price));
$sql = "INSERT INTO tbl_Files3";
$sql .= "(date_added,header,description,price, bin_data, filename, filesize, filetype) ";
$sql .= "VALUES (now(),'$strheader','$strDescription','$strPrice', '$data', ";
$sql .= "'$binFile_name', '$binFile_size', '$binFile_type')";
$result = mysql_query($sql, $db);
echo "Thank you. The new file was successfully added to our database.<br><br>";
echo "<a href='add.html'>Continue</a>";
} else {
echo "You were not able to upload this file. Please check the size of the image.<br><br>";
echo "<a href='add.html'>Try again</a>";
}mysql_close();
?>
<?php
}
?>
Many thanks in advance