bijju Posted September 26, 2007 Share Posted September 26, 2007 f(img1 !="") { @copy('img1', "image location") } else {................ } //// s ome problems is there in if commmand.. Quote Link to comment https://forums.phpfreaks.com/topic/70713-copying-the-files-to-database/ Share on other sites More sharing options...
cooldude832 Posted September 26, 2007 Share Posted September 26, 2007 you don't copy to a database you make the file into a string and store in a blob (for mysql) Quote Link to comment https://forums.phpfreaks.com/topic/70713-copying-the-files-to-database/#findComment-355428 Share on other sites More sharing options...
bijju Posted September 26, 2007 Author Share Posted September 26, 2007 donot understand please can u give some hint o r can u give some code for uploading the file Quote Link to comment https://forums.phpfreaks.com/topic/70713-copying-the-files-to-database/#findComment-355430 Share on other sites More sharing options...
chanchelkumar Posted September 26, 2007 Share Posted September 26, 2007 Buddy, Try this one... function upimage($grpimg,$grptype,$grp,$usid,$gpid) { if(empty($grpimg)) { header("Location:../index.php"); } $add="../uploads/user".$usid."/groups".$gpid."/".$grpimg; // the path name stored, upload is the directory name. if(move_uploaded_file($grp, $add)){ chmod("$add",0777); } else { //echo "Failed to upload file Contact Site admin to fix the problem"; //exit; } // Start the thumbnail generation// $n_width=100; // Fix the width of the thumb nail images $n_height=100; // Fix the height of the thumb nail imaage $tsrc="../uploads/user".$usid."/groups".$gpid."/".$grpimg; //-------------- // Path where thumb nail image will be stored if (!($grptype =="image/jpeg" OR $grptype=="image/gif" OR $grptype=="image/pjpeg")){ exit;} /// Starting of GIF thumb nail creation////// if ($grptype=="image/gif") { $im=ImageCreateFromGIF($add); $width=ImageSx($im); // Original picture width is stored $height=ImageSy($im); // Original picture height is stored $newimage=imagecreatetruecolor($n_width,$n_height); imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height); if (function_exists("imagegif")) { //Header("Content-type: image/gif"); ImageGIF($newimage,$tsrc); } elseif (function_exists("imagejpeg")) { //Header("Content-type: image/jpeg"); ImageJPEG($newimage,$tsrc); } chmod("$tsrc",0777); }// end of gif file thumb nail creation////// // starting of JPG thumb nail creation////// if($grptype=="image/jpeg"){ $im=ImageCreateFromJPEG($add); $width=ImageSx($im); // Original picture width is stored $height=ImageSy($im); $n_width=100; // Fix the width of the thumb nail images $n_height=100; // Original picture height is stored $newimage=imagecreatetruecolor($n_width,$n_height); imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height); ImageJpeg($newimage,$tsrc); chmod("$tsrc",0777); } if($grptype=="image/pjpeg"){ $im=ImageCreateFromJPEG($add); $width=ImageSx($im); // Original picture width is stored $height=ImageSy($im); $n_width=100; // Fix the width of the thumb nail images $n_height=100; // Original picture height is stored $newimage=imagecreatetruecolor($n_width,$n_height); imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height); ImageJpeg($newimage,$tsrc); chmod("$tsrc",0777); } } Quote Link to comment https://forums.phpfreaks.com/topic/70713-copying-the-files-to-database/#findComment-355449 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.