Techmate Posted August 7, 2011 Share Posted August 7, 2011 I have GD enabled but for some reason I get this error? <?php ini_set('display_errors', 1 ); //upload image $to = $_FILES['image']['name']; $where = $_FILES['image']['tmp_name']; //move uploaded image move_uploaded_file($where, "images/$to"); // call function mark("images/$to"); //add mark()here later function mark($location){ $watermark = imagecreatefromgif("watermark.gif"); $watermarkheight = imagesy($watermark); //height of watermark $watermarkwidth = imagesx($watermark); //width of watermark $image = imagecreatetruecolor($watermarkwidth, $watermarkheight); $image = imagecreatefromjpg($location); // get image size $size = getimagesize($location); $xpos = $size[0] - $watermarkwidth - 10; //10px away from right $ypos = $size[1] - $watermarkheight - 10; //10px away from bottom // merge watermark with original image imagecopymerge($image, $watermark, $xpos, $ypos, 0, 0, $watermarkwidth, $watermarkheight, 100); // save watermarked image imagejpeg($image, $location); //clearing buffer imagedestroy($image); imagedestroy($watermark); } ?> <form action="watermark.php" method ="POST" enctype="multipart/form-data"> <input type="hidden" name="upload" value="1"> <input type="file" name="image"> <input type="submit" value="Watermark"> </form> Quote Link to comment https://forums.phpfreaks.com/topic/244136-fatal-error-call-to-undefined-function-imagecreatejpg/ Share on other sites More sharing options...
Psycho Posted August 7, 2011 Share Posted August 7, 2011 Perhaps that is because there is no function called imagecreatejpg(). There is an imagecreate() and an imagecreatefromjpg() Quote Link to comment https://forums.phpfreaks.com/topic/244136-fatal-error-call-to-undefined-function-imagecreatejpg/#findComment-1253782 Share on other sites More sharing options...
Techmate Posted August 7, 2011 Author Share Posted August 7, 2011 Sorry Topic typo but it is correct in the script. And still have that error. Quote Link to comment https://forums.phpfreaks.com/topic/244136-fatal-error-call-to-undefined-function-imagecreatejpg/#findComment-1253792 Share on other sites More sharing options...
Psycho Posted August 7, 2011 Share Posted August 7, 2011 From the manual: http://www.php.net/manual/en/function.imagecreatefromjpeg.php Note: JPEG support is only available if PHP was compiled against GD-1.8 or later Check phpinfo() to verify jpg support is enabled and what version of GD you are using. Quote Link to comment https://forums.phpfreaks.com/topic/244136-fatal-error-call-to-undefined-function-imagecreatejpg/#findComment-1253807 Share on other sites More sharing options...
Techmate Posted August 7, 2011 Author Share Posted August 7, 2011 From the manual: http://www.php.net/manual/en/function.imagecreatefromjpeg.php Note: JPEG support is only available if PHP was compiled against GD-1.8 or later Check phpinfo() to verify jpg support is enabled and what version of GD you are using. I GD Version 2.0 not sure why i still get the error. GD Support enabled GD Version 2.0 FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.4.2 T1Lib Support enabled GIF Read Support enabled GIF Create Support enabled JPEG Support enabled libJPEG Version 6b PNG Support enabled libPNG Version 1.2.44 WBMP Support enabled Quote Link to comment https://forums.phpfreaks.com/topic/244136-fatal-error-call-to-undefined-function-imagecreatejpg/#findComment-1253822 Share on other sites More sharing options...
PFMaBiSmAd Posted August 7, 2011 Share Posted August 7, 2011 The function name is - imagecreatefromjpeg not imagecreatefromjpg Quote Link to comment https://forums.phpfreaks.com/topic/244136-fatal-error-call-to-undefined-function-imagecreatejpg/#findComment-1253833 Share on other sites More sharing options...
Techmate Posted August 7, 2011 Author Share Posted August 7, 2011 Wow. Oops. . Thanks Quote Link to comment https://forums.phpfreaks.com/topic/244136-fatal-error-call-to-undefined-function-imagecreatejpg/#findComment-1253841 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.