Questions tagged [php-imagine]

Image manipulation library for PHP 5.3 inspired by Python's PIL and other image libraries.

ImagineInterface (Imagine\Image\ImagineInterface) and its implementations is the main entry point into Imagine. You may think of it as a factory for Imagine\Image\ImageInterface as it is responsible for creating and opening instances of it and also for instantiating Imagine\Image\FontInterface object.

The main piece of image processing functionality is concentrated in the ImageInterface implementations (one per driver - e.g. Imagick\Image)

The main idea of Imagine is to avoid driver specific methods spill outside of this class and couple of other internal interfaces (Draw\DrawerInterface), so that the filters and any other image manipulations can operate on ImageInterface through its public API.

The main purpose of Imagine is to provide all the necessary functionality to bring all native low level image processing libraries in PHP to the same simple and intuitive OO API.

Several things are necessary to accomplish that:

  • Image manipulation tools, such as resize, crop, etc.
  • Drawing API - to create basic shapes and advanced charts, write text on the image
  • Masking functionality - ability to apply black&white or grayscale images as masks, leading to semi-transparency or absolute transparency of the image the mask is being applied to

The above tools should be the basic foundation for a more powerful set of tools that are called Filters in Imagine.

Useful Links

52 questions
1
vote
2 answers

opening image with Imagine gives 'An image could not be created from the given input'

I'm using Imagine to resize images after uploading them with curl in /tmp: $_imagine = new \Imagine\Gd\Imagine(); $mode = \Imagine\Image\ImageInterface::THUMBNAIL_INSET; $image = $_imagine->open($path); // i.e $path = '/tmp/photo.jpg' // then…
AbdelHady
  • 9,334
  • 8
  • 56
  • 83
0
votes
0 answers

Image rotate during save() imagine php

I use the imagine library to manage the sizing of images. $imagine = new Imagine\Imagick\Imagine(); $imagine->open($file) ->thumbnail(new Imagine\Image\Box(1000, 2000), Imagine\Image\ImageInterface::THUMBNAIL_INSET) …
AugTop
  • 23
  • 2
0
votes
1 answer

Getting error when using Imagine with Xampp PHP 8.0.1

When using the Imagine library with Xampp PHP 8.0.1, I'm getting an error with the open() function in the file Imagine/Gd/Imagine.php. Specifically, line #93 of code: $resource = @imagecreatefromstring($data); The returned value of $resource is…
0
votes
2 answers

Yii2 imagine PHP

Hey guys) Need your help. I use ext yii2-imagine. I try to save file in quality => 50, but it's not working. Image is always saved in quality => 100. Why can it happen ? $imagine = new Image(); $photo =…
0
votes
0 answers

Combine two images in Php - one top of another

I'm trying to create a photo collage in php by combining two images, a background and an image. Certain part of my background is transparent, I want to put the image into that part of the background and merge them. The transparent part could be a…
0
votes
2 answers

Internal Error while I am accessing image using imagine

I am facing issue while accessing this API. Can you please help me where I am wrong? public function index() { require_once('./application/libraries/imagine_autoloader.php'); $imagine = new \Imagine\Gd\Imagine(); $image =…
Umashankar
  • 694
  • 7
  • 21
0
votes
1 answer

PHP $_FILES same image name

I am trying to upload multiple images to php server, But for some reason it is using first image name for all the uploaded images, saving to same image name. I want it to save to their filename in the source folder. Like Banner1.jpg,Banner2.jpg and…
Davinder Singh
  • 64
  • 1
  • 10
0
votes
1 answer

DI with multiple intantiations of injected class

I'm using the Imagine library for some image live editing and am running up against a wall understanding how to decouple classes that I might need to build multiple instances of dynamically. Contrived Example namespace App; use Imagine\Image\{…
D Lowther
  • 1,609
  • 1
  • 9
  • 16
0
votes
1 answer

Yii2 render image in browser without image tag using yii2-imagine

I'm using yii2-imagine $imagine = yii\imagine\Image::getImagine(); Imagine->open('path/watermark.jpg')->show('jpg'); My problem is it not show the image, it show that: ����JFIF��>CREATOR: gd-jpeg v1.0 (using IJG JPEG v90), default quality ��C …
0
votes
0 answers

PHP Imagick annotateImage fails on some images

I have a PHP script which generates images from PDF pages using PHP Imagick. In which i write a piece of data on top of the image using annotateImage function and take it as output. This is failing recently on some PDF images being selected. I mean…
user2301765
  • 669
  • 2
  • 8
  • 22
0
votes
1 answer

Zend framework & Imagine : add text in image

I'm using Imagine together with Zend Framework 2. I'm looking for a way to add a text in image before save it. I tried with this : //create required instances... $Imagine = new \Imagine\Gd\Imagine(); $Palette = new…
Zakaria
  • 66
  • 1
  • 9
0
votes
1 answer

Imagine if open() method threw exception ignore then proceed to the next loop

I am trying to use Imagine to batch make 250x250 thumbnail of more than 90k+ relatively small mobile images. The problem is, when I run a loop, foreach ($images as $c) { $imagine = new Imagine(); $image = $imagine->open($c); $image->resize(new…
arvil
  • 840
  • 11
  • 27
0
votes
1 answer

How to handle Imagine exception in CakePHP 3

I suppose I don't manage correctly the exception using Imagine libray. My code is: use .... use Imagine\Exception; .... try { $imagine = new Imagine(); $image = $imagine->open($img_path . DS . "tmpfile." . $extension) ->resize(new…
fralbo
  • 2,534
  • 4
  • 41
  • 73
0
votes
1 answer

How to re-size image and upload in different folder with different size?

I am new in php. For my shopping website project I need your help. In my add_product page I have product image option. When I submit the form the File image will re-size in 3 different size in different folder like- 30x30 for Shopping cart icon in…
Daniel Smith
  • 1,626
  • 3
  • 29
  • 59
0
votes
1 answer

Imagine, get mime type

I cant find in imagine documentation https://imagine.readthedocs.org/en/latest/index.html how can i get mime type. I just open an image like this: $myImage = $imagine->open('/path/to/image.gif'); I have now $myImage, how can i get mime…
Łukasz
  • 321
  • 1
  • 2
  • 11