I’ve been searching all over the internet but I just can’t figure out how to get it working. Here’s my image upload script:
<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/bmp")
|| ($_FILES["file"]["type"] == "image/pdn")
|| ($_FILES["file"]["type"] == "image/psd")
|| ($_FILES["file"]["type"] == "image/x-png")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 5000000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
print "Successfully uploaded!<p>";
echo "File name: " . $_FILES["file"]["name"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kilobytes<br />";
$filename = $_FILES["file"]["name"];
$unique_id = uniqid (rand(), true);
echo $c;
echo "<br>";
$boo = "$unique_id-$filename";
move_uploaded_file($_FILES["file"]["tmp_name"],
"i/" . $boo);
print "<a href='";
print "http://trollin.info/i/";
print "$boo'>http://trollin.info/i/$boo</a>";
print "</p>HTML: <br><TEXTAREA style='WIDTH: 297px; HEIGHT: 47px' rows=1 cols=35><img src='http://trollin.info/i/$boo'></textarea><p> ";
print "<img src='http://trollin.info/i/";
print "$boo";
print "'>";
}
}
else
{
echo "Invalid file";
}
?>
It works perfectly, except the image is displayed at full size. I need a maximum height of 200 and a maximum width of 350 and it to stay at the same aspect ratio. I’ve tried using CSS/HTML, but that won’t work with considering the aspect ratio and the height/width.
I need to use GD/ImageMagick I think somehow, but I don’t know how to get it working with my script