$thumb_width=50; //change this number to your preference $thumb_height=50; -- itoctopus - http://www.itoctopus.com ""Humani Power"" <jiuman@xxxxxxxxx> wrote in message news:a75683750706032344g2cfec7c2i9ed354b8fc2e676e@xxxxxxxxxxxxxxxxx > Hey hi!!. > > I have a few pages that uploads images to the apache server and makes a > registry on a mysql database. Everything is going well just for a few > details. > > When I make the upload for an image, it creates me a thumb image, but not > as > I want. For example, if I have an image that its of 2000 x 2000 px, the > thumb created is 200 x 200, If I upload another with 300x300 px, my thumb > will be 30x30 px, making look the gallery pretty bad. The only thing that > I > need is that all my thumbs were on the same size. > I've tried to modify the thumb width and height size, but doesnt work.. > Probably I am not undersatnding hoy to use the resampling() tool. > > here is my code. > > <?php > include("connection.php"); > //make variables avaliable > $image_caption = $_POST['image_caption']; > $image_username = $_POST['image_username']; > $image_tempname = $_FILES['image_filename']['name']; > $image_date = date($_POST['image_date']); > $today= date("Y-m-d"); > //upload image and check for image type > $ImageDir="/var/www/apache2-default/images/"; > $Imagethumb=$ImageDir."thumbs/"; > $ImageName=$ImageDir . $image_tempname; > if (move_uploaded_file($_FILES['image_filename']['tmp_name'], > $ImageName)) { > //get info about the image being uploaded > > > list($width, $height, $type, $attr)= getimagesize($ImageName); > > //insert info into the table > $insert= "insert into rsiis_images > (image_caption,image_username,image_date,image_date_upload) > values > ('$image_caption','$image_username','$image_date','$today')"; > $insertresults=mysql_query($insert) > or die(mysql_error()); > $lastpicid=mysql_insert_id(); > > > $newfilename=$ImageDir . $lastpicid .".jpg"; > if($type==2){ > rename($ImageName, $newfilename); > } else { > if ($type==1){ > $image_old=imagecreatefromgif($ImageName); > }elseif ($type==3){ > $image_old=imagecreatefrompng($ImageName); > } > > //"convert the image to JPG > > $image_jpg=imagecreatetruecolor($width,$height); > imagecopyresampled($image_jpg,$image_old, 0, 0, 0, 0, $width, > $height,$width,$height); > > imagejpeg($image_jpg,$newfilename); > imagedestroy($image_old); > imagedestroy($image_jpg); > } > > $newthumbname=$Imagethumb.$lastpicid.".jpg"; > //get dimensions of the thumbnail > > $thumb_width=$width*0.10; > $thumb_height=$height*.10; > > //Create thumbnail > $largeimage=imagecreatefromjpeg($newfilename); > > $thumb=imagecreatetruecolor($thumb_width,$thumb_height); > imagecopy($thumb, $largeimage, 0, 0, 0, 0,$width,$height); > imagecopyresampled($thumb, $largeimage, 0, 0, 0, 0, > > $thumb_width,$thumb_height,$width,$height); > imagejpeg($thumb,$newthumbname); > imagedestroy($largeimage); > imagedestroy($thumb); > > > $url="location:showimage.php?id=".$lastpicid; > header($url); > > > } > > > ?> > > > > thanks for your help > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php