Hi, I am trying to make a util whereby ppl can upload their own images to my server
for me to automatically display them.
The below code works fine, but I have the following problem.
It only works fne if everyone complies to a standard of a set width and height for the
image. This is not always possible, so I'm looking for a way to accept the image in
any form they have and then to scale it
to fit within an acceptable height/width range.
This I need help with, so if someone could hep me ( at the hand of my current code) I
would be very pleased.
Thanks
Petre
below my code snippet
<?php
if ($submit) {
if ($file != "none") {
$current_time = time();
$location_pic = "/home/www/imgs/listings/".$current_time.$file_name;
$url_pic =
"http://www.website.co.za/imgs/listings/".$current_time.$file_name;
copy ($file,$location_pic);
$db= mysql_pconnect("localhost","db_user","db_password");
mysql_select_db("DB_NAME",$db);
$sql = "update table set location_pic = \"$location_pic\", url_pic =
\"$url_pic\" where id = \"$id_pic\" ";
$result = mysql_query($sql);
}
echo "Picture Uploaded! Thank You!<br>";
echo "Below is a preview of how your logo will look. If it displays
incorrectly, adjust your image with an image editor of choice and upload again.<br>";
echo "<img src=\"$url_pic\" width=\"350\" height=\"150\">";
}else {
echo "
Please use this form to upload image.<br><br><br>
<form method=\"post\" action=\"$PHP_SELF\" enctype=\"multipart/form-data\">
Logo Location : <input type=\"file\" name=\"file\"><br><br><br><br>Please Note!Your
image must be smaller than 50KB!
<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"50000\">
<input type=\"hidden\" name=\"id_pic\" value=\"$id\"><br>
<input type=\"submit\" name=\"submit\" value=\"submit\">
";}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php