Hi!
Why do I get this errormessage when trying to upload a image with GD?
Warning: imagegif() [function.imagegif]: Unable to open 'path is here' for writing in 'path to scriptname here' on line..
I've checked the webserver and all GD library (also support GIF) are enabled and installed correct.
I use this code, but maybe it is incorrect:
if( !empty($_FILES['imagefile']['name']) ) {
$tmpName = $_FILES['imagefile']['tmp_name'];
$filetype = $_FILES['imagefile']['type'];
$imgName = $_FILES['imagefile']['name'];
$imgPath = 'images/webimages/' . $imgName;
[code=php]if ( strstr($filetype, 'image/gif') ){
$mainImage = imagecreatefromgif($tmpName);
$width = 135;
$height = 75;
$mainWidth = imagesx($mainImage);
$mainHeight = imagesy($mainImage);
$image_p = imagecreatetruecolor($width, $height);
imagecopyresampled($image_p, $mainImage, 0, 0, 0, 0, $width, $height, $mainWidth, $mainHeight);
imagegif($image_p, $imagePath, 80);
$picture = $imgName; //stored in my database
if (!imagegif) {
echo "Did not manage to copy";
}