Jump to content

save image after jrcop


exhaler

Recommended Posts

hi all,

 

i'm trying to save an image after cropping it using jcrop (jquery plugin).

i'm currently using a script i found on the internet called ImageManipulation.php (attached).

its working fine, but i get a black image if i crop a gif, or png images (works great for jpg images).

 

$objImage = new ImageManipulation("../products/" . $_SESSION['image']); 
if ($objImage->imageok) {
    // get x, y, w, h from hidden inputs that are update by jcrop
    $objImage->setCrop($_POST['x'], $_POST['y'], $_POST['w'], $_POST['h']);
    $objImage->resize(150);
    $objImage->save("../products/" . $_SESSION['image']);
}

 

how can i fix this?? if you have a better way of using php with jcrop to save cropped images please share it :)

thanks for the help

 

[attachment deleted by admin]

Link to comment
Share on other sites

I think litebearer might have misinterpreted that comment.  It only referred to some sample gd code.  There is no problem doing .gif or png files with the library you are using as far as I can see.  It supports jpg, gif, bmp and png.

 

I really don't know what the issue is.  What does it say when you run phpinfo() in the gd section?

Link to comment
Share on other sites

if i upload a gif or png image i can use jcrop to select the area i want from that image. however, after i click on the crop button and send the x, y, w, h to ImageManipulation.php i get a black image.

 

i also ran a test in wordpress, uploaded a gif image selected a crop area using jcrop then clicked on the crop button, the result was a jpg cropped image and not a gif image.

 

how can i change a gif/png image to a jpg one?

Link to comment
Share on other sites

sorry for the late reply had to come home to get the phpinfo:

GD Support 		enabled
GD Version 		bundled (2.0.34 compatible)
FreeType Support 	enabled
FreeType Linkage 	with freetype
FreeType Version 	2.4.3
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
XBM Support 		enabled
gd.jpeg_ignore_warning	0	0 

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.