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
15
votes
1 answer

Using PHP Imagine to apply a mask

I have the following: namespace App\Http\Controllers; use Illuminate\Http\Request; use Imagine\Image\Box; use Imagine\Image\ImageInterface; use Imagine; class UploadController extends Controller { public function processImage($request) { …
imperium2335
  • 23,402
  • 38
  • 111
  • 190
6
votes
4 answers

Laravel - Imagick not installed

using Laravel and trying to work on image upload using Imagine. The issue is that I get the error stating: Imagine \ Exception \ RuntimeException Imagick not installed Open:…
Lovelock
  • 7,689
  • 19
  • 86
  • 186
4
votes
1 answer

LiipImagineBundle: change the path where the images are saved after applying the filter

I have this this config: liip_imagine: resolvers: default: web_path: ~ filter_sets: cache: ~ subitem_in_category: path: ~ ///how to change the default path where the images are saved? …
tirenweb
  • 30,963
  • 73
  • 183
  • 303
3
votes
3 answers

yii2 resize images maintaining aspect ratio with Imagine

I got this code in yii2: Image::thumbnail($path, 100, 100)->save($thumbnail, ['quality' => 50]); I thought that it will resize the original image maintaining the aspect ratio. But it just creates a box... What can be wrong?
ps202
  • 95
  • 2
  • 11
3
votes
2 answers

failed to install imagine class with require(vendor/autoload.php error on centos6.5/php5.4

I know many users have asked same question before but it wasn't helpful for me... I have a VPS (centOS6.5/directadmin/php5.4/SSH terminal) I try install imagine (https://imagine.readthedocs.org) class in my server via getcomposer.org These are my…
ali raha
  • 211
  • 1
  • 2
  • 14
3
votes
1 answer

How to debug an image creation

I am trying to fix/debug a site where all images in the site are being generated by an script. Another developer created this. Now all the images for some reason don’t work. I am trying to debug the code and try to break it somewhere where it should…
Jonathan Thurft
  • 4,087
  • 7
  • 47
  • 78
3
votes
3 answers

How to pad thumbnails with imagine library

I am using imagine library to create thumbnails for images. It is as simple as this. $size = new \Imagine\Image\Box(240, 180); $imagine->open($source_path)->thumbnail($size, 'inset')->save($target_path); the library provides two modes : inset and…
bkilinc
  • 989
  • 2
  • 13
  • 28
2
votes
2 answers

I need to calculate where to crop an image given x&y coordinates

I need to crop an image in the middle the original image on my application, to make the crop I need to provide the (x,y) coordinates, and that makes crop to start in the given coordinates. So I understand in order to calculate x and y i need to…
Pablo Palacios
  • 2,767
  • 20
  • 37
2
votes
0 answers

Convert format while doing thumbnail

I'm using LiipImagineBundle to make thumbnails for images uploaded by users. So far so good. Today I discovered that some users are uploading tiff images, that are not displayed in most modern browsers. So, I'd want to convert thumbnails for such…
Massimiliano Arione
  • 2,422
  • 19
  • 40
2
votes
1 answer

How can I resize an image then centralize it with a white background? Can it be done using php-Imagine library?

The effect I would like to generate is exactly like the example in this StackOverflow thread: (Related Question) 1.Resize image 2.Keep proportion 3.Add or Fill none-image areas with white background Here are three examples of this process below: 1.…
infiniteloop
  • 885
  • 2
  • 12
  • 29
2
votes
1 answer

yii2 Enable Imagine for console cron jobs

I am using a block of code protected function generateBgThumbs($release,$promo) { $thumb = ($promo->catalog_based) ?Yii::$app->params['promo_cover_thumb_upload_path'].DIRECTORY_SEPARATOR.'600x600_' . $release->cover_file …
2
votes
1 answer

PHP Stapler and Imagine Image autororate issue

I'm getting some inconsistency with the autorotate functionality of Stapler, and was hoping someone could explain what's happening. My styles are defined as follows on an Eloquent model: 'styles' => [ 'thumbnail' => [ 'dimensions' =>…
flyingL123
  • 7,686
  • 11
  • 66
  • 135
2
votes
1 answer

Yii2 - Imagine - creating a thumbnail and keeping transparent background

I am trying to upload an image and scale it to maximum 200px width or 200px height depends which is bigger, using Imagine. I read this link: Imagine where it says: If one of thumbnail dimensions is set to null, another one is calculated…
Sigal Zahavi
  • 1,045
  • 2
  • 21
  • 42
2
votes
1 answer

Yii2 - Imagine create new image without temp file

I'm new to imagine library (and in yii2 at all) and I wonder is there a way to edit a new uploaded image without storing the original file before. Currently I do something like this: // store original image (it will not be used anymore, so we will…
user3845133
2
votes
1 answer

imagerotate changes original image's color

I am encountering a very strange behavior when rotating images with PHP. The original image is being changed during the rotation. As an example, here are the side by side images. It's hard to see, but if you look closely, the white area…
Steven Musumeche
  • 2,886
  • 5
  • 33
  • 55
1
2 3 4