Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#136 2010-05-03 23:38:13
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
If there is a JS problem, then you don’t have it installed correctly.
Verify the placement of the jCrop folder. failing that, use the firefox error console and look and see what may be at issue.
Offline
#137 2010-05-04 00:14:29
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
Well i have this two errors
error: $.Jcrop is not a function (line 212)
error: myCrop is not defined (line 487)
Last edited by sebatorresi (2010-05-04 00:15:12)
Sonríe | Smile . <txp:lover />
Offline
#138 2010-05-04 00:17:37
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
my mistake, is working now.
Sonríe | Smile . <txp:lover />
Offline
#139 2010-05-08 18:20:59
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
Hi TheEric,
I’m trying to patch the plugin for PNG transparency/alpha support, but I’m not being successful in the mission.
So far, I’ve don this on line 835:
case '.png':
$srcimage = imagecreatefrompng($imagedir . $filename);
imagealphablending($srcimage, true); // setting alpha blending on
imagesavealpha($srcimage, true); // save alphablending setting (important)
break;
An also have tried this, on line 953:
case ".png":
imagealphablending($newimg, true); // setting alpha blending on
imagesavealpha($newimg, true); // save alphablending setting (important)
$fileresult = imagepng($newimg,$imagedir . $filename);
break;
But no luck… yet.
There are no error messages on the output, but the plugin keeps working fine. It creates the images (thumbnails, crops, etc) but doesn’t keep the alpha channel.
Any ideas on how to get this working?
Thanks.
Offline
#140 2010-05-08 20:35:35
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
OK, I’v patched the plugin to support the cropping and thumbnail creation of transparent PNGs.
The patch is probably far from perfect. I’ve borrowed some of the code from TXP’s revision 3301 that does something similar for PNG/GIFs, when using the built-in cropper.
Take into consideration that this patch is only for PNG images, I haven’t adapted it for GIFs.
Also, for some reason, I couldn’t fully adapt the code from TXP revision, so I ended up applying an stripped down version that seems to be general for both PNG/GIF images. The TXP revision 3301 also included some specific code for PNG images that I couldn’t make work properly.
In other words, I got better results with this stripped-down PNG/GIF generic code than with the PNG-specific code.
Here is the patch.
diff -r f98558d516d5 website/textpattern-4.2.0/textpattern/plugins/active/ebl-image-edit_v2.0.php
--- a/website/textpattern-4.2.0/textpattern/plugins/active/ebl-image-edit_v2.0.php Sat May 08 12:10:55 2010 -0300
+++ b/website/textpattern-4.2.0/textpattern/plugins/active/ebl-image-edit_v2.0.php Sat May 08 17:25:07 2010 -0300
@@ -833,7 +833,10 @@
$srcimage = imagecreatefromgif($imagedir . $filename);
break;
case '.png':
- $srcimage = imagecreatefrompng($imagedir . $filename);
+ list($width, $height) = getimagesize($imagedir . $filename);
+ $original_image = imagecreatefrompng($imagedir . $filename);
+ $srcimage = imagecreatetruecolor($width, $height);
+ imagecopyresampled($srcimage, $original_image, 0, 0, 0, 0, $width, $height, $width, $height);
break;
}
@@ -949,11 +952,18 @@
$fileresult = imagegif($newimg,$imagedir . $filename);
break;
case ".png":
+ //patch for getting transparent images
+ $trans_color = imagecolorsforindex($srcimage, 0);
+ $trans_idx = imagecolorallocate($newimg, $trans_color['red'], $trans_color['green'], $trans_color['blue']);
+ imagefill($newimg, 0, 0, $trans_idx);
+ imagecolortransparent($newimg, $trans_idx);
+
$fileresult = imagepng($newimg,$imagedir . $filename);
break;
}
imagedestroy($srcimage);
+ imagedestroy($original_image);
}
if($action != 'thumbnail')
Offline
#141 2010-05-11 21:15:40
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
It should have worked as it was without modification.
Offline
#142 2010-08-28 10:08:30
- johnnie
- Member
- Registered: 2007-03-10
- Posts: 58
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
I have added the jcrop directory to /textpattern/, yet I am still gettng the “$Jcrop is not a function” en myCrop is not defined errors. Any ideas?
Last edited by johnnie (2010-08-28 10:09:17)
Offline
#143 2010-08-28 19:21:28
- johnnie
- Member
- Registered: 2007-03-10
- Posts: 58
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
Never mind! I had to rename the jcrop files to lower-case and all works fine now :) Awesome plugin!
Offline
#144 2010-09-12 13:15:19
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
A little patch which updates thumbnail’s dimensions after thumb resize\creating. I post only how code looks after changes (it’s easy to see what changed):
Line #777
$filename = $id.$ext;
$tmbsrc = $id.'t'.$ext;
Near line #910
if($action != 'thumbnail')
{
list ($width,$height) = getimagesize($imagedir . $filename);
$rs = safe_update('txp_image', "w = '".$width."', h = '".$height."'", "id = $id");
} else {
list ($width,$height) = getimagesize($imagedir . $tmbsrc);
$rs = safe_update('txp_image', "thumbnail = '1', thumb_w = '".$width."', thumb_h = '".$height."'", "id = $id");
}
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
#145 2010-09-12 17:24:55
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
Why are the dimensions of the thumbnail important/relevant enough to be saved to the dB?
Last edited by TheEric (2010-09-12 17:37:33)
Offline
#146 2010-09-12 20:14:06
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
TheEric wrote:
Why are the dimensions of the thumbnail important/relevant enough to be saved to the dB?
Because thumbnail dimensions could be used, for example, to ouput in html – it’s used by <txp:thumbnail /> and other methods (i use them via smd_gallery)
Here it code of thumbnail() function
P.S. This topic name is v.1 but your site’s version of plugin is v.2
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
#147 2010-09-24 08:12:57
- Joey
- Member
- From: Netherlands
- Registered: 2005-01-19
- Posts: 257
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
I got the following error when trying to resize an image of less than 1MB:
<br />
<b>Fatal error</b>: Allowed memory size of 33554432 bytes exhausted (tried to allocate 17152 bytes) in <b>/home/public_html/textpattern/lib/txplib_misc.php(594) : eval()’d code</b> on line <b>779</b><br />
Any ideas?
Regards,
Joey
Offline
#148 2010-09-24 08:31:34
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
What are image dimensions?
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
#149 2010-09-24 08:37:52
- Joey
- Member
- From: Netherlands
- Registered: 2005-01-19
- Posts: 257
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
2000 width in this specific case, but anything larger gives me exactly the same.
Thanks
Regards,
Joey
Offline
#150 2010-09-24 13:37:32
Re: [plugin] [ORPHAN] ebl_image_edit v1.0
What about smaller?
Offline