corillo181 Posted November 26, 2006 Share Posted November 26, 2006 <?php// The file name you wish to get$filename = 'images/pic.jpg';// Content typeheader('Content-type: image/jpeg');//takes the with and height of filelist($width, $height) = getimagesize($filename);$newWidth=120;$newHeight=intval($height*$newWidth/$width);$oldImage=ImageCreateFromJPEG("$filename");$newImage=ImageCreateTrueColor($newWidth,$newHeight);imagecopyresampled($newImage,$oldImage,0,0,0,0,$newWidth,$newHeight,$width,$height);ImageJPEG($newImage,"TN"."jhon.jpg");?> i got this code, but i would like to know how can i make this so i can put it on mysql..becuase the imageJPEG() function saves the picture and makes the picture show on the page i just want to keep the picture in a variable so i can insert it in the sql table i got set up..if you need a better explanation please let me know.. Link to comment https://forums.phpfreaks.com/topic/28556-thumbnails/ Share on other sites More sharing options...
corillo181 Posted November 26, 2006 Author Share Posted November 26, 2006 why are pictures realated question so hard for people to answer?everytime i got one i get a response in like weke or 2..and i cna never find a tutorial that focus on everything about image..is there something else better to use image then php? Link to comment https://forums.phpfreaks.com/topic/28556-thumbnails/#findComment-130667 Share on other sites More sharing options...
fert Posted November 26, 2006 Share Posted November 26, 2006 what are you asking? Link to comment https://forums.phpfreaks.com/topic/28556-thumbnails/#findComment-130684 Share on other sites More sharing options...
corillo181 Posted November 26, 2006 Author Share Posted November 26, 2006 i'm asking that code i posted how can i make it so i can save the picture turned into a thumbnail in to a mysql table. Link to comment https://forums.phpfreaks.com/topic/28556-thumbnails/#findComment-130688 Share on other sites More sharing options...
fert Posted November 26, 2006 Share Posted November 26, 2006 [code]$cn=@mysql_connect("host","username","password") or die(mysql_error());@mysql_select_db("name",$cn) or die(mysql_error());$file=@fopen("test.jpg","r");$text=@fread($file,filesize("test.jpg"));@fclose($file);@mysql_query("INSERT INTO `table` (picture) VALUES('$text')",$cn) or die(mysql_error());[/code]in the table picture must be a BLOB Link to comment https://forums.phpfreaks.com/topic/28556-thumbnails/#findComment-130693 Share on other sites More sharing options...
corillo181 Posted November 26, 2006 Author Share Posted November 26, 2006 not trying to save the actual picture in mysql.. i just want to get the name as a variable tha tis what i dont know how to do..get a variable name out of the code i showed.. Link to comment https://forums.phpfreaks.com/topic/28556-thumbnails/#findComment-130698 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.