Jump to content

Fatal error call to undefined function imagecreatejpg()


Techmate

Recommended Posts

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>

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.

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

 

 

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.