Jump to content

saved as resource id?


takn25

Recommended Posts

Hi, I was in the process of making thumnails for avatars It used to work before but now the files are being saved as resource ID and not in an image format. I can not point out what the issue is and also may I add when I try to echo nothing is happening.

 

$filename = $_FILES['myfile']['tmp_name'];

if ($_POST['cpic'])

{


// Set a maximum height and width
$width = 100;
$height = 100;


// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);

$ratio_orig = $width_orig/$height_orig;
$ratio_orig;


if ($width/$height > $ratio_orig) {
   $width = $height*$ratio_orig;
} else {
   $height = $width/$ratio_orig;
}


// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);

$location = "cid/$myid/$filename"; 
imagejpeg($image_p, $location, 100);


$query =mysql_query ("UPDATE clp SET avatar ='$location' WHERE cid='1'");
header ("LOCATION: editprofile.php");
}

Link to comment
https://forums.phpfreaks.com/topic/233730-saved-as-resource-id/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.