bigshwa05 Posted May 25, 2006 Share Posted May 25, 2006 Hi there,This is the first time i ve worked with the GD library. I am very new to php so heres what i am trying to do. I have created a simple HTML Form that looks like so.#############################<form action="php.php" method="$_POST" enctype="multipart/form-data">Upload Image: <input type="file" name="imagename"><font size="1">Click browse to upload a local file</font><input type="submit" value="Upload Image"></form>#############################Now i am trying to use this PHP script named php.php to accept the image from that form and process it accordingly<?php// Get File and set new size$filename = $_GET["$imagename"];$percent = 0.5;// Content typeheader('Content-type: image/jpeg');// Get new sizeslist($width, $height) = getimagesize($filename);$newwidth = $width * $percent;$newheight = $height * $percent;// Load$thumb = imagecreatetruecolor($newwidth, $newheight);$source = imagecreatefromjpeg($filename);// Resizeimagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);// Outputimagejpeg($thumb);?> ###################The form seems to be passing the files name over to the form but it is not actually passing the image which is what i would like.Any advice would be greatly appreciated.Bigshwa Quote Link to comment https://forums.phpfreaks.com/topic/10424-php-jpeg-thumbnail-creation/ Share on other sites More sharing options...
zq29 Posted May 25, 2006 Share Posted May 25, 2006 Change this:<form action="php.php" method="$_POST" enctype="multipart/form-data">To this:<form action="php.php" method="post" enctype="multipart/form-data">Change this:$filename = $_GET["$imagename"];To this:$filename = $_FILES['imagename']['tmp_name']; Quote Link to comment https://forums.phpfreaks.com/topic/10424-php-jpeg-thumbnail-creation/#findComment-38879 Share on other sites More sharing options...
bigshwa05 Posted May 25, 2006 Author Share Posted May 25, 2006 Works perfect now. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/10424-php-jpeg-thumbnail-creation/#findComment-38973 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.