Zebra_Image, a lightweight image manipulation library written in PHP

Get the latest updates on this PHP library via RSS



You are currently browsing comments. If you would like to return to the full story, you can read the full entry here: “Zebra_Image, a lightweight image manipulation library written in PHP”.

83 responses to “Zebra_Image, a lightweight image manipulation library written in PHP”

Follow the comments via RSS
  • jacob lee, 2012-10-06, 10:07

    Could you show me the easy way to have watermark on image?
    Thanks in advance.

    Reply
  • Brian H., 2012-10-29, 21:21

    I keep coming back to this library, as it’s the best one I’ve found for modifying and saving uploaded images. Has it ever been configured to be used in CodeIgniter?

    Reply
    • Stefan Gabos, 2012-10-29, 21:23

      not that I know of…but it’s as standalone as it gets 🙂 so it should be fairly easy to be used with any framework

  • Bastian, 2013-01-16, 19:25

    Thanks you for this great library. I have one question, when I resize a file, it does not overwrite an already existing (resized) image. Do you know of this?

    Reply
    • Stefan Gabos, 2013-01-16, 19:30

      are you setting the proper permissions to the image?

    • Bastian, 2013-01-16, 19:35

      I’m running XAMPP (test server) on Windows 7. So i’ll guess that permissions do not matter. I tried adding unlink() to the script. But then I get a permission denied error.

    • Stefan Gabos, 2013-01-16, 19:46

      strange…I am using something similar WAMP on Windows 7 and it’s working…

    • Bastian, 2013-01-16, 19:44

      Btw. i get error 3: ‘Could not write target file!’

  • Bastian, 2013-01-16, 20:08

    Solved. I had to do this at the top of function _write_image()

    chmod($this->target_path, 0777);
    unlink($this->target_path);

    This is only for Windows, because on my webserver, the permissions are already 777

    Reply
  • Malik, 2013-01-24, 21:02

    This is one easy to use library, man I cant believe how easy it was to use this. Keep up the good work. No! Keep up the great work. All the best

    Reply
    • Stefan Gabos, 2013-01-26, 11:18

      thank you!

  • Eren Türkay, 2013-02-07, 03:34

    Thank you for such a beatiful and well-written library! It couldn’t be more easier to use it. I had one issue with silented errors and I debugged the problem. It would be better to inform the users about a possible error (related with bigger image resolutions such as 2560×1600).

    Please see my stackoverflow reply for it.

    http://stackoverflow.com/questions/4590441/php-thumbnail-image-resizing-with-proportions/14743045#14743045

    My best regards,
    Eren

    Reply
    • Stefan Gabos, 2013-02-07, 08:12

      thank you! i’ll have a look and correct that

  • Bartek, 2013-02-27, 11:38

    Are you planning to make it possible to add watermarks to animated gifs? Is it possible with some libraries, but when I do it using Zebra Image gifs don’t move.

    Reply
    • Stefan Gabos, 2013-02-27, 14:01

      it’s not possible at all to add watermarks to images with Zebra_Images, nor is this planned

  • mrapp, 2013-03-25, 13:45

    When $img->source_path is $_FILES[‘upl_image’][‘tmp_name’], then i can only manipulate i only one time.

    $img->source_path = $_FILES[‘upl_image’][‘tmp_name’];
    $img->target_path = ‘nename.jpg’;
    $img->resize(600, 0, ZEBRA_IMAGE_CROP_CENTER); // working

    $img->target_path = ‘secondname.jpg’;
    $img->resize(150, 0, ZEBRA_IMAGE_CROP_CENTER); // not working

    Reply
    • Stefan Gabos, 2013-03-25, 17:53

      it’s probably because PHP’s garbage collector kicks in (as the file is in the temporary directory and would be removed by the time the script ends, but for some reason you trigger this behaviour because you “touch” the file)
      i always first move uploaded files to a safe spot and then do the work

  • Benny, 2013-04-18, 10:29

    Hello,

    i try using this. i have a problem:
    my image has a large height, the width is smale. i uploaded the image to the server first and start than the resize.
    my original big image is ok, the thumbnail is rotate to the left site so that width is now larger than height.

    any idea why? can i disable this?

    Reply
    • Stefan Gabos, 2013-04-23, 05:51

      can you please email me the code you are using along with the image?

  • Bman, 2013-05-21, 21:16

    Thanks much for this great script ! it’s exactly what I was looking for.

    I can create individual images OK.. but how can I process multiple images at once with the same filter ? like coloring 10 images at once after changing a one variable to black color for example ?

    Thanks again

    Reply
    • Stefan Gabos, 2013-05-22, 06:36

      using a for-each?

  • Christian Bocaz, 2013-08-01, 03:21

    Hi, thanks for this great image library.
    I use xampp over win7.
    My php.ini have a memory_limit = 128M.
    But when I run this script, I get this error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4320 bytes) in A:\xampp\htdocs\temp\Zebra_Image.php on line 1272

    My cript is:

    require 'Zebra_Image.php';
      $image = new Zebra_Image();
    
      $bigsize = 800;
      $smallsize=150;
    
      $image->preserve_aspect_ratio = true;
      $image->enlarge_smaller_images = true;
      $image->jpeg_quality = 100;
      $image->preserve_time = true;
    
      $image->source_path = 'image.jpg';
      $image->target_path = 'image_small.jpg';
      $image->resize(0, $smallsize, ZEBRA_IMAGE_CROP_CENTER);
    
      $image->target_path = 'image_big.jpg';
      $image->resize(0, $bigsize, ZEBRA_IMAGE_CROP_CENTER);
    Reply
    • Christian Bocaz, 2013-08-01, 03:38

      sorry, and the original image size is 3.472kb

  • Christian Bocaz, 2013-08-01, 05:33

    Solved: the upload_max_filesize must be bigger than image sizes or we need to evaluate the image size before

    Reply
  • kisay, 2013-08-02, 11:25

    thanks for your shares!
    thanks for google takes me here.

    a php beginer from china.

    Reply
  • Daniel, 2013-09-30, 20:38

    Just wanted to say thanks for this great library. I use it and love it. Even a novice PHP developer like myself figured it out. Thanks for the great work & documentation.

    Reply
    • Stefan Gabos, 2013-09-30, 20:54

      As Nick Cave once said: “No man, thank *You*!” 🙂

  • Helge, 2014-03-21, 12:18

    Hi!

    Great libraray. But i missed a feature. It is possible to get an image with a fixed size of 100×100 form a given image with a size of 70×50 and the image is not scaled up? So i have an image with 100×100 with centered source image.
    This works perfect with images greater than the size of 100×100

    Reply
    • Stefan Gabos, 2014-03-22, 19:17

      how can we have a 100×100 image from 70×50 without scaling it up?

    • Helge, 2014-03-24, 11:18

      Hi!

      you have to center it in the middle like the funktion far from phpthump (leave original size)

Leave a Reply

Your email address will not be published
You can use <strong>, <em>, <a>, <img>, <code>
Characters are not case-sensitive