PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Ree
Forum Regular
Posts: 592 Joined: Fri Jun 10, 2005 1:43 am
Location: LT
Post
by Ree » Tue Nov 08, 2005 8:02 am
I'm trying GD library atm, and for some reason I cannot upload/resize images. Here's what I have:
Code: Select all
<?php
if (isset($_FILE['img1']))
{
list($width, $height) = getimagesize($_FILE['img1']['tmp_name']);
$new_width = $width * 0.5;
$new_height = $height * 0.5;
$img1 = imagecreatefromjpeg($_FILE['img1']['tmp_name']);
$img1_new = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($img1, $img1_new, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg($img1_new, 'images/boogie.jpg');
echo '<img border="0" src="images/boogie.jpg">';
}
?>
<form enctype="multipart/form-data" action="gd.php" method="post">
<input type="file" name="img1"></br>
<input type="submit" value="Go">
</form>
What am I doing wrong?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Nov 08, 2005 8:12 am
$_FILE
$_FILES
Ree
Forum Regular
Posts: 592 Joined: Fri Jun 10, 2005 1:43 am
Location: LT
Post
by Ree » Tue Nov 08, 2005 8:14 am
omg omg omg!!