Hello there,
I have just finished off my upload script and now I am looking for something to resize my image twice, one to a medium size then another to a thumbnail.
I have searched online and have tried incorporating some scripts but all the info in the scripts is to much for me to take in haha…
Wondered if anyone can help me incorporate some kind of resizer?
Here is my current code:
<form name="uploader" method="POST" enctype="multipart/form-data">
<p>Image Name:</p>
<p><input type="text" name="title" class="imageUploader" /></p>
<p>Image Description:</p>
<p><textarea name="message" class="upload_desc"></textarea></p>
<p>File Name:</p>
<p><input type="file" name="file" class="image_upload" /></p>
<p><input type="submit" value="Upload" class="upload_submit" /></p>
</form>
[php]
if($_SERVER[‘REQUEST_METHOD’] == ‘POST’){
if(($_FILES[‘file’][‘type’] == ‘image/gif’)
|| ($_FILES[‘file’][‘type’] == ‘image/jpeg’)
|| ($_FILES[‘file’][‘type’] == ‘image/png’)){
if($_FILES[‘type’][‘error’] > 0){
echo "Return Code: " . $_FILES[‘file’][‘error’] . “
”;
}else{
$title = $_POST[‘title’];
$desc = $_POST[‘message’];
$original = $_FILES[‘file’][‘name’];
$ext = pathinfo($_FILES[‘file’][‘name’], PATHINFO_EXTENSION);
$newfiles = md5(time()) . "." . $ext;
if(move_uploaded_file($_FILES['file']['tmp_name'], "./upload/".$original)){
mysql_query("INSERT INTO `img` (`title`, `desc`, `img_s`, `img_m`, `img_org`) VALUES ('".$title."', '".$desc."', '".$newfiles."', '".$newfiles."', '".$original."')");
echo "<p>Upload successful!</p>";
}else{
echo "<p>Failed to upload!</p>";
}
}
}else{
echo "<p>Invalid file type!</p>";
}
}
[/php]
This currently uploads the image to the file and puts all the info I want into my db, just resizing is causing me immense pain at the moment haha.