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

Overview

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

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.
Comments
  • Background Layer is black after addLayerOnTop()

    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

    opened by davkraid 18
  • Animated GIF bugged colors

    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

    opened by Kekke88 12
  • Fatal error: Uncaught Error: Class 'PHPImageWorkshop\Core\ImageWorkshopLayer'

    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

    question 
    opened by ZhunevWork 11
  • ImageWorkshop::initFromPath error

    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?

    bug 
    opened by rhnkyr 9
  • Installation problem

    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
    opened by Goodoh 9
  • Fix PHP8

    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

    opened by loogaroo 8
  • Tag Versions

    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.

    opened by philsturgeon 8
  • Fatal error: You must give a php image var to initialize a layer.

    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?

    opened by chriz1984 7
  • Installing ImageWokshop

    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

    opened by Goodoh 5
  • PHP8 uses GDImage object instead resource

    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?

    opened by hidden-life 4
  • Webp support

    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

    opened by josegarzi2 4
  • resizeToCover, like in css?

    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;
        }
    
    opened by marcusdiy 0
  • GifCreator and global color palette?

    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?

    opened by goodwin74 0
  • Opening an optimized PNG (256 colors) result a grey block

    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?

    opened by daguruman 1
  • GifCreator doesn't work

    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);
    
    ?>
    
    opened by BartTotal 0
  • Documentation Issues

    Documentation Issues

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

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

    opened by mklahorst 0
Releases(3.0.0-alpha1)
Owner
Clément Guillemain
Clément Guillemain
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

catchIT 7 Dec 30, 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

Redeye Group 106 Aug 17, 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.

null 59 Oct 5, 2022
PHP library to resize, scale and crop images.

PHP library to resize, scale and crop images.

Gumlet 1.1k Jan 3, 2023
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

Tobias Reich 6.2k Dec 31, 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 Organisation 2.3k Jan 1, 2023
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

Clément Guillemain 320 Dec 15, 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

New Media Campaigns 144 Sep 7, 2022
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

Spatie 374 Dec 30, 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. 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.

Erika Heidi 172 Jan 5, 2023
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

Flowframe 53 Oct 17, 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

Magegadgets 6 Dec 23, 2022
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

MilesChou 4 May 30, 2022
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

Grégoire Passault 958 Dec 29, 2022
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

KS 24 Oct 23, 2021
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

inspiredminds 6 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. Star us on Github! More than 200 plugins and themes available. Join us and contribute!

Piwigo 1.8k 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

null 135 Dec 4, 2022
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

The League of Extraordinary Packages 2.4k Dec 19, 2022