Jump to content

copying the files to database


bijju

Recommended Posts

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);
}


}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.