Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#133 2010-05-03 15:20:09

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: [plugin] [ORPHAN] ebl_image_edit v1.0

Its a graphics library which is normally installed on most web hosts, but apparently not on yours. The other well know library is called ImageMagick.

Offline

#134 2010-05-03 17:19:14

sebatorresi
Member
From: Spain
Registered: 2009-05-27
Posts: 105
Website

Re: [plugin] [ORPHAN] ebl_image_edit v1.0

Ok, thank you.


Sonríe | Smile . <txp:lover />

Offline

#135 2010-05-03 20:51:03

sebatorresi
Member
From: Spain
Registered: 2009-05-27
Posts: 105
Website

Re: [plugin] [ORPHAN] ebl_image_edit v1.0

Ok, i’ve solved the GD problem. I can rotate and make a backup but i can’t make the crop and the thumbnail.

invalid crop values detected

I can’t drag on the image if i do that anything happens.

I think may be is a javascript problem but the file (js and css) is in the txp directory.


Sonríe | Smile . <txp:lover />

Offline

#136 2010-05-03 23:38:13

TheEric
Plugin Author
From: Wyoming
Registered: 2004-09-17
Posts: 566

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

sebatorresi
Member
From: Spain
Registered: 2009-05-27
Posts: 105
Website

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

sebatorresi
Member
From: Spain
Registered: 2009-05-27
Posts: 105
Website

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

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#140 2010-05-08 20:35:35

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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')

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#141 2010-05-11 21:15:40

TheEric
Plugin Author
From: Wyoming
Registered: 2004-09-17
Posts: 566

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

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

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

Board footer

Powered by FluxBB