ImageWorkshop is a PHP5.3+ library that helps you to manage images based on GD library

Last update: Aug 10, 2022

================================

ImageWorkshop class

================================

Test status Latest Stable Version Total Downloads Monthly Downloads License

Summary and features

Really flexible and easy-to-use PHP class to work with images using the GD Library

http://phpimageworkshop.com/

Installation

The class is designed for PHP 5.3+, but it can work with older PHP versions... Check how to install the class here: http://phpimageworkshop.com/installation.html

Usage

What's new in the doc' ?

@todo

  • Adding a method to add easily borders to a layer (external, inside and middle border)
  • Check given hexa' color and remove # if exists.

GitHub

https://github.com/Sybio/ImageWorkshop
Comments
  • 1. Background Layer is black after addLayerOnTop()

    Hi guys,

    btw, great work! But I have one problem after using the function addLayerOnTop(). After saving the created image (as PNG) the background is always black. Here's the part of my code:

    $sImagesPath = DOCUMENT_ROOT . '/img';
    
    // background size 512x512
    $backgroundLayer = PHPImageWorkshop\ImageWorkshop::initFromPath($sImagesPath.'/background.png');
    
    // overlay size 120x45
    $overlay = PHPImageWorkshop\ImageWorkshop::initFromPath($sImagesPath.'/overlay.png');
    $backgroundLayer->addLayerOnTop($overlay, 10, 10, 'LT');
    
    // saving image
    $backgroundLayer->save($sImagesPath, 'generated_test.png', false, null, 100);
    

    Is there a problem with the background image maybe (I used different images)?

    Thanks for helping, David

    Reviewed by davkraid at 2014-05-04 17:23
  • 2. Animated GIF bugged colors

    Hello, I've been trying to add an image upon a GIF image using your libraries.

    However, it turns the gif image into some weird blue color. I have tried to debug but I can't find what's wrong, I tried using getResult with a background color but it still didn't help.

    I printed the frames as images and it seems that image #2 is the first image to get weird colors.

    Here is the picture before: http://i.imgur.com/M3bM7yP.gif

    and after: http://i.imgur.com/lyMu2P0.gif

    All the images extracted: http://imgur.com/2kFqUzw,TAxAjeC,YzM4ztE,alotpAS,CdUTa7a,IQQiylp,BjI14CD,IlrQZiC,mo2vrs1,QPEsR67,ohFZ4sN,xM9jzvC,GyA3Toa,Eepmqhv,O5vxpfc,IE1lKG9,EqP9foq,VAtE7oY,sVsteMd,NtQziAE,YVKMGfz,4GEgyBf,3cvPE7m,hgJtWCt,dbbQSNe,mrBjnRN,MgAbBqi,1i3yhLn,43GUKOu,hkmXP0n,ysajT72#1

    Regards

    Reviewed by Kekke88 at 2014-02-27 12:58
  • 3. Fatal error: Uncaught Error: Class 'PHPImageWorkshop\Core\ImageWorkshopLayer'

    Hello, I try use your library^ reading tutorial "Manage animated GIF with ImageWorkshop". My gif have animation. Watermark - png image. I logging code for search stop point. Help me please. What causes an exception? | PHP version used | 5.6

    index.php 32 // Initialization of the watermark layer 33 $watermarkLayer = ImageWorkshop::initFromPath(DIR.'/folder/Pictures/orange.png');

    ImageWorkshop.php 95 $layer = new ImageWorkshopLayer($image, $exif);

    Debug log:

    /usr/bin/php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 /Users/dmitry/site/index.php Open gif | Extractions of the GIF frames and their durations |new GifFrameExtractor() | $gfe->extract($gifPath) |
    Fatal error: Uncaught Error: Class 'PHPImageWorkshop\Core\ImageWorkshopLayer' not found in /Users/dmitry/site/src/PHPImageWorkshop/ImageWorkshop.php:95 Stack trace: #0 /Users/dmitry/site/index.php(33): PHPImageWorkshop\ImageWorkshop::initFromPath('/Users/dmitry/s...') #1 {main} thrown in /Users/dmitry/site/src/PHPImageWorkshop/ImageWorkshop.php on line 95

    Process finished with exit code 255

    Reviewed by ZhunevWork at 2018-01-18 14:46
  • 4. ImageWorkshop::initFromPath error

    Hi guys,

    i updated the latest (2.0.7) via composer. my working code which contains ImageWorkshop::initFromPath get broke and gives 500 error. I tried debug it but phpstorm just stops the debug and gives nothing. Any idea?

    Reviewed by rhnkyr at 2015-03-29 21:12
  • 5. Installation problem

    I have raised this problem before. I have in a test file.

    I'm getting error undefined function Is it something to do with the path. I also have a script folder and in there I have a file myscript.js. An external javascript.

    That does not work but does if not in the script folder. I don't understand why as it should but reading in forum I saw where and to the point lib Add ImageWorkshop.php in lib you now have lib/ImageWorkshop.php Images folder give 777 rights to allow the script to create images inside.

    _ _ DIR _ _.'/resources/image.jpg',)); is that the way to go
    Reviewed by Goodoh at 2013-10-13 20:57
  • 6. Fix PHP8

    Fix for PHP8

    • type of imageCreateFromString seems to be object now in PHP 8 (instead of resource)

    | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Fixed tickets | | License | MIT

    Reviewed by loogaroo at 2020-12-07 10:31
  • 7. Tag Versions

    You need to tag versions as you are creating them, otherwise packagist will not know you've released a new version.

    I am currently implementing PHP Image Workshop like this:

    "sybio/image-workshop" : "*",
    

    I want to be implementing it like this:

    "sybio/image-workshop" : "1.3.*",
    

    This would mean that I can build my application around a specific version (while allowing minor patches) and would also mean that I don't get 2.0 forced down my throat when you push a few new commits.

    This has caused errors on my live site. To get around it I have forked the repo, hard pushed to 6288ef205136b3a30dd5e4b582dc27aa993c9b4c and referenced the commit in my repo.

    Please, please implement tags.

    Reviewed by philsturgeon at 2012-11-27 15:21
  • 8. Fatal error: You must give a php image var to initialize a layer.

    Hi, It works very good on my localhost.

    On the Live Server i get:

    Fatal error: Uncaught PHPImageWorkshop\Exception\ImageWorkshopBaseException: [2]: You must give a php image var to initialize a layer. thrown in /inc/PHPImageWorkshop/Core/ImageWorkshopLayer.php on line 142

    Whats the Problem?

    Reviewed by chriz1984 at 2014-11-03 08:34
  • 9. Installing ImageWokshop

    I am all new to this but a willing leaner. I search the forum and found this advice testing if installed. To the point as I have un commented all require_once in all files in PHPImageWorkshop folder that I have in my lib folder. test this script.

    Got True

    output: test

    Got false Tested that file ImageWorkshop.php exists and got True Then tried

    output fatal error: call to undefined function require_once()in C:\apachehtdocs\website\test.php on line 3 then tried

    And I got the same fatal error as before At other times doing something a little different fatal error :require_once():failed opening required"PHPImageWorkshop/ImageWorkshop.php'(include_path='.;C:apache\php\PEAR')in C:\apache\htdocs\website\test.php on line 3 Your help would be very appreciated. When I down loaded the zip ImageWorkshop_master only recently it is on my download file and I have unzipped and have the file PHPImageWorkshop in my lib file as it says inn the installations etc. I am using xampp with with php5.5.0 if that may be of importance Thanks Goodoh

    Reviewed by Goodoh at 2013-10-03 23:05
  • 10. PHP8 uses GDImage object instead resource

    | Q | A | ---------------- | ----- | Bug report? | no | Feature request? | no | Usage question? | yes | PHP version used | 8.0

    In released PHP 8 there are type system changes. One of this change is using \GDImage class object instead of resource . For more information here. What do you think about adding support of PHP 8 to library?

    Reviewed by hidden-life at 2020-12-08 07:59
  • 11. Webp support

    | Q | A | ---------------- | ----- | Bug report? | no | Feature request? | yes | Usage question? | no | PHP version used | 7.2

    Good Morning

    I saw that in the latest version of the library (2.1.0) they support the webP format.

    When trying to start a layer with an image in this format, the library throws the error: Not an image file (jpeg / png / gif)

    Looking through the code I saw that support for this format is only when saving the result image.

    Do you plan to support the loading of layers?

    Thank you

    Reviewed by josegarzi2 at 2019-10-13 10:01
  • 12. resizeToCover, like in css?

    | Q | A | ---------------- | ----- | Bug report? | no | Feature request? | no | Usage question? | yes | PHP version used | 7.4

    Hi, i was looking for a way to resize an image, without squashing it or blackbars, and to make sure that all the area should be cover. I found that there is a similar method called resizeToFit ...so maybe you could add another method in the same class. It would be resizeToCover, it should work just like the CSS cover attribute. What do you think?

        /**
         * Resize the layer to cover a bounding box by specifying pixel
         *
         * @param integer $width
         * @param integer $height
         * @param integer $positionX
         * @param integer $positionY
         * @param string $position
         */
        public function resizeToCover($width, $height, $px = 0, $py = 0, $position = 'MM')
        {
            $this->cropToAspectRatioInPixel($width, $height, $px, $py, $position);
            $this->resizeInPixel($width, $height);
            return $this;
        }
    
    Reviewed by marcusdiy at 2020-10-22 21:38
  • 13. GifCreator and global color palette?

    There is a problem in GifCreator. In some gifs, the colors blink. Looking for problems on the Internet and studying the contents of GIF files, I realized that this is a problem because the imagegif() creates each frame with its own color palette. And so the colors of each frame change, and you get the effect of flickering colors. This problem is solved as follows: create a global color palette for the entire animated GIF.

    @skwi How can this be done in GifCreator?

    Reviewed by goodwin74 at 2019-12-07 19:12
  • 14. Opening an optimized PNG (256 colors) result a grey block

    | Q | A | ---------------- | ----- | Bug report? | yes | Feature request? | no | Usage question? | no | PHP version used | 7.2, 5.4

    It is not possible to work with PNG 256Palette pictures?

    Reviewed by daguruman at 2019-11-17 11:23
  • 15. GifCreator doesn't work

    Hi I tryed your GifCreator. It doesn't give any reaction or image. Not even a Error:

    <?php
    use GifCreator\GifCreator as GifCreator;
    
    
    require_once('GifCreator.php');
    
    
    
    // Create an array containing file paths, resource var (initialized with imagecreatefromXXX), 
    // image URLs or even binary code from image files.
    // All sorted in order to appear.
    $frames = array("image_1.png", "image_2.png");
    
    // Create an array containing the duration (in millisecond) of each frames (in order too)
    $durations = array(40, 80);
    
    // Initialize and create the GIF !
    $gc = new GifCreator();
    $gc->create($frames, $durations, 5);
    
    ?>
    
    Reviewed by BartTotal at 2019-04-29 17:14
  • 16. Documentation Issues

    | Q | A | ---------------- | ----- | Bug report? | yes

    Seems like you have https//http conflicts on your main website that has documentation.

    Reviewed by mklahorst at 2018-11-05 21:31
The image server plugin allows you to add responsive images via config without extra elements

Grav image server plugin adds picture tag with loading, responsive, high density images

May 18, 2022
Create beautiful generative background images from a string. Based on jasonlong/geo_pattern

GeoPattern This is a PHP port of jasonlong/geo_pattern. Generate beautiful tiling SVG patterns from a string. The string is converted into a SHA and a

Feb 25, 2022
This is a class of php QR Code, This library helps you generate QR codes in a jiffy.

This is a class of php QR Code, This library helps you generate QR codes in a jiffy.

Jun 30, 2022
PHP library to resize, scale and crop images.
PHP library to resize, scale and crop images.

PHP library to resize, scale and crop images.

Aug 12, 2022
A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.

Lychee A great looking and easy-to-use photo-management-system. Since the 1st of April 2018 this project has moved to it's own Organisation (https://g

Aug 16, 2022
A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
 A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.

Aug 13, 2022
GifCreator is a PHP class that creates animated GIF from multiple images

================================ GifCreator ================================ GifCreator is a PHP class to create animated GIF from multiple images For

Aug 3, 2022
Create images with embedded text using advanced typography

Image with Text This class makes it super easy to render images with multiple, independently styled text blocks. You can control each text block's ali

May 3, 2022
Easily convert images with Glide
Easily convert images with Glide

Easily convert images with Glide This package provides an easy to use class to manipulate images. Under the hood it leverages Glide to perform the man

Aug 1, 2022
A PHP GD + TwitterOAuth demo to dynamically generate Twitter header images and upload them via the API.
A PHP GD + TwitterOAuth demo to dynamically generate Twitter header images and upload them via the API.

A PHP GD + TwitterOAuth demo to dynamically generate Twitter header images and upload them via the API. This enables you to build cool little tricks, like showing your latest followers or sponsors, latest content creted, a qrcode to something, a progress bar for some goal, and whathever you can think of.

Jul 27, 2022
Optimize your images on the fly with Glide for Laravel.
Optimize your images on the fly with Glide for Laravel.

Glide for Laravel Optimize your images on the fly with Glide for Laravel. Support us Like our work? You can support us by purchasing one of our produc

Mar 2, 2022
Upload SVG images in Magento 2.x

Upload SVG images in Magento 2.x This extension for Magento 2 allows uploading SVG images in the following sections: wysiwyg editor in static blocks a

Mar 12, 2022
Inline Images Protocol implementation for PHP.
Inline Images Protocol implementation for PHP.

Imgecho Echo the image on iTerm App using Inline Images Protocol. Installation Use Composer to install. composer require mileschou/imgecho Usage Use

May 30, 2022
The Gregwar\Image class purpose is to provide a simple object-oriented images handling and caching API
The Gregwar\Image class purpose is to provide a simple object-oriented images handling and caching API

Gregwar's Image class The Gregwar\Image class purpose is to provide a simple object-oriented images handling and caching API. Installation With compos

Aug 4, 2022
Simple, fast and secure archive for images
Simple, fast and secure archive for images

Slim Image Archive Simple*, fast and secure archive for images: Create multiple categories with multiple albums with multiple images! Manage multiple

Oct 23, 2021
Contao extension to provide the possibility of defining alternative images to be used on different output devices.
Contao extension to provide the possibility of defining alternative images to be used on different output devices.

Contao Image Alternatives This extensions expands the capabilities of using responsive images with art direction in Contao. You will have the possibil

May 30, 2022
Manage your photos with Piwigo, a full featured open source photo gallery application for the web
Manage your photos with Piwigo, a full featured open source photo gallery application for the web

Manage your photos with Piwigo, a full featured open source photo gallery application for the web. Star us on Github! More than 200 plugins and themes available. Join us and contribute!

Apr 14, 2022
PHPExif is a library which gives you easy access to the EXIF meta-data of an image

PHPExif v0.6.4 PHPExif is a library which gives you easy access to the EXIF meta-data of an image. PHPExif serves as a wrapper around some native or C

Aug 4, 2022
Wonderfully easy on-demand image manipulation library with an HTTP based API.
Wonderfully easy on-demand image manipulation library with an HTTP based API.

Glide Glide is a wonderfully easy on-demand image manipulation library written in PHP. Its straightforward API is exposed via HTTP, similar to cloud i

Aug 8, 2022