exhaler Posted March 21, 2011 Share Posted March 21, 2011 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 https://forums.phpfreaks.com/topic/231302-save-image-after-jrcop/ Share on other sites More sharing options...
litebearer Posted March 21, 2011 Share Posted March 21, 2011 From - http://deepliquid.com/content/Jcrop_Implementation_Theory.html Obviously this script has some limitations. First of all, it only works with jpeg images, while the gd library functions support many common file formats. It appears they have yet to implement coding for other formats. Link to comment https://forums.phpfreaks.com/topic/231302-save-image-after-jrcop/#findComment-1190551 Share on other sites More sharing options...
exhaler Posted March 21, 2011 Author Share Posted March 21, 2011 damn it , and thanks for help litebearer. however, i think it is solvable, i just need to learn how to convert any image (png, gif,...) to jpeg and then crop it using jcrop Link to comment https://forums.phpfreaks.com/topic/231302-save-image-after-jrcop/#findComment-1190566 Share on other sites More sharing options...
gizmola Posted March 21, 2011 Share Posted March 21, 2011 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 https://forums.phpfreaks.com/topic/231302-save-image-after-jrcop/#findComment-1190572 Share on other sites More sharing options...
exhaler Posted March 22, 2011 Author Share Posted March 22, 2011 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 https://forums.phpfreaks.com/topic/231302-save-image-after-jrcop/#findComment-1190736 Share on other sites More sharing options...
gizmola Posted March 22, 2011 Share Posted March 22, 2011 You didn't provide the information I requested. Link to comment https://forums.phpfreaks.com/topic/231302-save-image-after-jrcop/#findComment-1190752 Share on other sites More sharing options...
exhaler Posted March 22, 2011 Author Share Posted March 22, 2011 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 https://forums.phpfreaks.com/topic/231302-save-image-after-jrcop/#findComment-1190855 Share on other sites More sharing options...
litebearer Posted March 22, 2011 Share Posted March 22, 2011 If you are able to 'grab' x,y, w & h' - you should be able to easily modify this (http://www.nstoia.com/sat/crop/index.php) to crop your images. Link to comment https://forums.phpfreaks.com/topic/231302-save-image-after-jrcop/#findComment-1190901 Share on other sites More sharing options...
exhaler Posted March 22, 2011 Author Share Posted March 22, 2011 thanks for the help litebearer Link to comment https://forums.phpfreaks.com/topic/231302-save-image-after-jrcop/#findComment-1190910 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.