uisneach Posted February 13, 2009 Share Posted February 13, 2009 HelloEverybody Anyone should be able to help me out to find some goodscripts on the web to resize allthe pictures I upload dinamically from client to server? I simply wantto create thumbs for this purpose thanks Paolo:)) Quote Link to comment Share on other sites More sharing options...
angelcool Posted February 13, 2009 Share Posted February 13, 2009 Here: <?php // Create source image and dimensions $src_img =imagecreatefromgif("bulb_gif.gif"); $srcsize = getimagesize('bulb_gif.gif'); $dest_x = 50; $dest_y = (50/ $srcsize[0]) * $srcsize[1]; $dst_img = imagecreatetruecolor($dest_x, $dest_y); //$white = imagecolorallocate($dst_img,255,255,255); imagefill($dst_img, 0, 0, $white); // Resize image //imagecolortransparent($dst_img,$white); //imagealphablending($dst_img, 0); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_x, $dest_y, $srcsize[0], $srcsize[1]); // Output image header("content-type: image/png"); imagegif($dst_img,'',100);//imagejpeg($dst_img,"",85); // Destroy images imagedestroy($src_img); imagedestroy($dst_img); ?> Check it out yourself, Original pix: http://10-network.net/image_thumbial/bulb_gif.gif Resized thumbnail:http://10-network.net/image_thumbial/gif.php I hope it helps, Angel Quote Link to comment Share on other sites More sharing options...
uisneach Posted February 13, 2009 Author Share Posted February 13, 2009 Hello Angel. thx ! It's cool Just a question this is my viewer.php file which print on video the pic. echo "thanks for upload pic:"; echo "<br />"; echo "number:"; $nesql = "SELECT id_pic, description FROM (SELECT id_pic, description FROM foto ORDER BY id_pic DESC) a LIMIT 1"; $nentry = mysql_query ($nesql); $new = mysql_fetch_row ($nentry); echo "<span style='font-size: 16px; font-weight:bold'> "; print_r ($new[0]); echo "<br />"; echo "</span>"; echo "<span style='font-size: 16px;font-weight:bold'>name: "; print_r ($new[1]); echo "<br />\n"; echo "<img src = 'http://www.xxxxx.com/public/foto/".$new[0].".jpg' />"; echo "</span>"; echo "<br />\n"; I am a noob, very sorry, don't know how and where linkin your script with mine. I think they must be different script, mustn't they? But theproblem for me it's to u.s. which varioable to be used here, wher put the link to resize.php hope i am clear Bye p. Quote Link to comment Share on other sites More sharing options...
angelcool Posted February 14, 2009 Share Posted February 14, 2009 Check this out: http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/uploading-files-to-mysql-database.aspx Replace the first line of code in the example I gave you to: $src_img =imagecreatefromgif("http://www.example.com/download.php"); Good luck. Angel Quote Link to comment Share on other sites More sharing options...
uisneach Posted February 14, 2009 Author Share Posted February 14, 2009 Hi Sorry man, but i don't get how to link to my file I mean, the upload file or view file? $src_img =imagecreatefromgif("http://www.example.com/download.php"); Download.php should is like Upload? or view? sorry Quote Link to comment Share on other sites More sharing options...
angelcool Posted February 14, 2009 Share Posted February 14, 2009 The upload.php is for the user to upload the file to the DB. The download.php is to retrieve the file from DB. Once you are able to retrieve the file (pix) you can resize it with the example I first posted. Read the tutorial in the link I gave you. cheers Quote Link to comment Share on other sites More sharing options...
uisneach Posted February 16, 2009 Author Share Posted February 16, 2009 Thx I have a glance and then let you know Cheers Quote Link to comment 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.