PHP Image Manipulation

Overview

Intervention Image

Intervention Image is a PHP image handling and manipulation library providing an easier and expressive way to create, edit, and compose images. The package includes ServiceProviders and Facades for easy Laravel integration.

Latest Version Build Status Monthly Downloads

Requirements

  • PHP >=5.4
  • Fileinfo Extension

Supported Image Libraries

  • GD Library (>=2.0)
  • Imagick PHP extension (>=6.5.7)

Getting started

Code Examples

// open an image file
$img = Image::make('public/foo.jpg');

// resize image instance
$img->resize(320, 240);

// insert a watermark
$img->insert('public/watermark.png');

// save image in desired format
$img->save('public/bar.jpg');

Refer to the official documentation to learn more about Intervention Image.

Contributing

Contributions to the Intervention Image library are welcome. Please note the following guidelines before submitting your pull request.

  • Follow PSR-2 coding standards.
  • Write tests for new functions and added features
  • API calls should work consistently with both GD and Imagick drivers

License

Intervention Image is licensed under the MIT License.

Copyright 2017 Oliver Vogel

Comments
  • Call to undefined method Intervention\Image\Facades\Image::make()

    Call to undefined method Intervention\Image\Facades\Image::make()

    I am unable to make images. I get the following message:

    Symfony \ Component \ Debug \ Exception \ FatalErrorException Call to undefined method Intervention\Image\Facades\Image::make() open: /Users/Sites/gcfs/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php

    I am running Intervention\Image 1.6.2

    opened by nickdelja 39
  • Can't install successfully

    Can't install successfully

    Can't install successfully "require": { "laravel/framework": "4.1.*", "intervention/image": "dev-master", }

    $ composer update Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

    Problem 1 - Installation request for intervention/image dev-master -> satisfiable by i ntervention/image[dev-master]. - intervention/image dev-master requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.

    opened by raselkhancse 34
  • Error reading certain JPG's:

    Error reading certain JPG's: "NotReadableException: Image source not readable"

    I have the latest version installed in my Laravel 4 app, it works 80% of time time but for some reason certain JPG's cause it to throw a 500 error that says "Image source not readable". Any JPG from my Canon 7D DSLR causes that error. If I import the image to Photoshop and re-save it then it'll work just fine. But I've also found the same issue with quite a few images from the web. If I pick 10 images at random about 20% of them will fail consistently.

    Seems like a bug.

    opened by nathanfirth 29
  • Unable to init from given url

    Unable to init from given url

    http://cdn.dota2.com/apps/570/icons/econ/leagues/subscriptions_ren_ren_yi_che_joy_league_first_season_large.1cf72b430b0f4bac6fd480b4f79e82448d8eefde.p

    Why error was thrown in this url using remote url?

    opened by ronjunevaldoz 27
  • Empty content

    Empty content

    Hey there, I am using your package along with the new version of Laravel (5.2) and I am getting and empty content (blank image) using the example that you got posted on your web site.

    Example:

    // create a new image resource $img = Image::canvas(800, 600, '#ff0000');

    // send HTTP header and output image data header('Content-Type: image/png'); echo $img->encode('png');

    I do not know why it happens because I have the same controller doing the duty with the before Laravel version and it works fine.

    any guide will be great.

    thanks!

    opened by gocanto 22
  • Blank image

    Blank image

    This package does not work on Laravel 5.2 all of a sudden. It used to work fine before, but now it does not generate images. The following code:

        Route::get('test', function() {
            $img = \Image::make(public_path().'/images/image-square.png')->resize(300, 200);
    
            return $img->response('jpg');
        });
    

    Used to work just fine, but now it fails resulting in this:

    image

    Whats wrong?

    opened by simplenotezy 21
  • Transparent watermarks? (using insert())

    Transparent watermarks? (using insert())

    Hi,

    I've tried inserting a transparent watermark using a png but the transparent section of the watermark is rendered as white. I've attached a copy of the image it generates along with the watermark I am using.

    516f8cfdddad8_large

    watermark

    Do you know if transparent watermark overlays are possible with the current script, or if I am doing this wrong? The code I used was using the example provided in the docs.

    Thanks

    bug 
    opened by dinglidingli 18
  • Intervention/image with Flysystem

    Intervention/image with Flysystem

    Hello,

    I just discovered Flysystem and learn that it will be integrated into Laravel 5.0. Is it possible to use Flysystem with Intervention/image right now in Larravel 4.2 and how, or do you plan to support it?

    Thanks.

    opened by mikeshow 17
  • PNG w/ transparency to JPEG conversion creates black background

    PNG w/ transparency to JPEG conversion creates black background

    Not sure if there is a workaround when inputting a transparent PNG but generating a JPEG with your package. Let me know if you'd like to see an example or if this is a common problem. Thanks.

    opened by egekhter 16
  • Unable to read exif data unless loaded from path

    Unable to read exif data unless loaded from path

    At the momement it's only possible to read exif data from images loaded from a path.

    exif_read_data supports the ability to load from base64 encoded data-urls. This means it is possible, in theory, to read exif data from images that are loaded through any of the init methods and not just those from file paths.

    Would there be any support from the maintainers of this library to add exif reading capabilities to images loaded through means other than files?


    related: https://github.com/Intervention/image/issues/336

    opened by dhensby 14
  • imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file

    imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file

    I am using this package with laravel and for some files that I am trying to resize it happens randomly I get this error:

    imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file"

    Stack Frame

    /Applications/MAMP/htdocs/laravelweb/vendor/intervention/image/src/Intervention/Image/Image.php
    
           case IMG_PNG:
           case 3:
           $this->resource = imagecreatefrompng($path);
           break;
    
           case IMG_JPG:
           case 2:
           $this->resource = imagecreatefromjpeg($path);
           break;
    
    opened by altrim 13
  • "Missing argument" errors when using named arguments

    Hey,

    I recently started using named arguments in PHP and I noticed when I use them with functions such as widen(), I'd get the following errors:

    Missing argument 1 for widen()
    
    at vendor/intervention/image/src/Intervention/Image/Commands/Argument.php:71
    

    Given this input:

    $image->widen(
          width: 500,
          callback: fn ($constraint) => $constraint->upsize(),
    );
    

    It looks like there is a wrapper around the input which does not expect/support named arguments.

    opened by HassanZahirnia 0
  • gd-webp cannot allocate temporary buffer

    gd-webp cannot allocate temporary buffer

    PHP Fatal error:  gd-webp cannot allocate temporary buffer in ...\vendor\intervention\image\src\Drivers\Gd\Decoders\BinaryImageDecoder.php on line 33
    
       Symfony\Component\ErrorHandler\Error\FatalError 
    
      gd-webp cannot allocate temporary buffer
    
      at ...\vendor\intervention\image\src\Drivers\Gd\Decoders\BinaryImageDecoder.php:33
         29▕         if (is_a($this->inputType($input), ImageGif::class)) {
         30▕             return $this->decodeGif($input); // decode (animated) gif
         31▕         }
         32▕
      ➜  33▕         $gd = @imagecreatefromstring($input);
         34▕
         35▕         if ($gd === false) {
         36▕             throw new DecoderException('Unable to decode input');
         37▕         }
    
    
       Whoops\Exception\ErrorException 
    
      gd-webp cannot allocate temporary buffer
    
      at ...\vendor\intervention\image\src\Drivers\Gd\Decoders\BinaryImageDecoder.php:33
         29▕         if (is_a($this->inputType($input), ImageGif::class)) {
         30▕             return $this->decodeGif($input); // decode (animated) gif
         31▕         }
         32▕
      ➜  33▕         $gd = @imagecreatefromstring($input);
         34▕
         35▕         if ($gd === false) {
         36▕             throw new DecoderException('Unable to decode input');
         37▕         }
    
      1   ...\vendor\filp\whoops\src\Whoops\Run.php:486
          Whoops\Run::handleError("gd-webp cannot allocate temporary buffer", "...\vendor\intervention\image\src\Drivers\Gd\Decoders\BinaryImageDecoder.php")
    
      2   [internal]:0
          Whoops\Run::handleShutdown()
    

    Same error with Version Alpha 5

    opened by KodaCHC 0
  • Write text on the picture. The height of single text is the same

    Write text on the picture. The height of single text is the same

        $text = "上饶市";
        $image = Image::canvas(count(mb_str_split($text))*60, 58);
        $image->text($text, count(mb_str_split($text))*30, 58, function ($font) {
            $font->file(base_path("/fonts/hanzi.ttf"));
            $font->size(58);
            $font->color('#FF3F30');
            $font->align('center');
            
        });
        return $image->response("png");
    
    opened by wanghousheng 0
  • Allow EXIF data to be read from streams.  Fixes: #1190

    Allow EXIF data to be read from streams. Fixes: #1190

    Intervention can create images from filenames and streams (and others).

    PHP:exif_read_data() can read EXIF data from both filenames and streams (since PHP 7.2).

    But when intervention creates an Image from a stream, it reads the data (excluding the EXIF data), and then creates a new stream from just the image data. Thus the EXIF data is lost.

    We lose the original stream (and the EXIF data) here: src/Intervention/Image/AbstractDecoder.php#L125

    We create a new stream from this (EXIF-less) data here: src/Intervention/Image/Commands/StreamCommand.php#L20

    When we create an image from a file, we store the basename/dirname in the Image object. (Actually, in the parent File object). This original data is used to read EXIF data.

    This PR uses a similar approach for images created from a stream. We keep a copy of the original stream and use it when we need the EXIF data.

    I created a test case for this, using a rotated image. This test passes. There are a number of pre-existing test failures, which I haven't investigated.

    opened by fisharebest 1
A Laravel package that adds a simple image functionality to any Laravel model

Laraimage A Laravel package that adds a simple image functionality to any Laravel model Introduction Laraimage served four use cases when using images

Hussein Feras 52 Jul 17, 2022
🖼️ Laravel Nova Field for uploading and cropping images using Slim Image Cropper

??️ Laravel Nova Field for uploading and cropping images using Slim Image Cropper

Marius 5 Apr 2, 2022
Manipulating Photos in Laravel with Intervention Image

This is the source code behind the Laracasts Larabit: Manipulating Photos in Laravel with Intervention Image, and features all of the files and code available in that video.

Andrew Schmelyun 1 Feb 10, 2022
Laravel 9 Livewire Multiple Image Upload Example

Laravel livewire multiple image upload; Through this tutorial, i am going to show you how to upload multiple image using livewire in laravel apps.

Wesley Sinde 3 Feb 23, 2022
Laravel 4.* and 5.* service providers to handle PHP errors, dump variables, execute PHP code remotely in Google Chrome

Laravel 4.* service provider for PHP Console See https://github.com/barbushin/php-console-laravel/releases/tag/1.2.1 Use "php-console/laravel-service-

Sergey 73 Jun 1, 2022
Public API for the project coding.events. Made in PHP 8.0 with Lumen 8, PHP-FPM, NGINX and MySQL 8.

coding.events API Uma API feita apenas para passar o tempo, montando uma API para o site <coding.events>. Sinta-se livre para usar esse código como es

Kaique Garcia 3 Oct 9, 2022
PHP phonebook with map (Active Directory, LDAP -> MySQL, PHP)

LDAP phonebook ???? ???? Development ветка Вопросы предпочтительнее задавать в Issues, а не по почте Корпоративный телефонный справочник с отображение

null 47 Nov 30, 2022
States allows you to create PHP classes following the State Pattern in PHP.

States allows you to create PHP classes following the State Pattern in PHP. This can be a cleaner way for an object to change its behavior at runtime without resorting to large monolithic conditional statements and this improve maintainability and workflows writing.

Teknoo Software 10 Nov 20, 2022
PHP components - collection of cross-project PHP classes

PHP components Collection of cross-project PHP classes. Install: $ composer require ansas/php-component Ansas\Component\Convert\ConvertPrice Convert "

null 1 Jan 5, 2022
Lavacharts is a graphing / charting library for PHP 5.4+ that wraps Google's Javascript Chart API.

Lavacharts 3.1.12 Lavacharts is a graphing / chart library for PHP5.4+ that wraps the Google Chart API. Stable: Dev: Developer Note Please don't be di

Kevin Hill 616 Dec 17, 2022
PHP Secure Headers

Secure Headers Add security related headers to HTTP response. The package includes Service Providers for easy Laravel integration. Version Installatio

null 431 Dec 26, 2022
A Simple GUID creator Laravel Package for PHP

A Simple GUID creator package for PHP. This package is useful for creating globally unique identifiers (GUID). It's under MIT license so it's free for

Sujip Thapa 15 Jun 26, 2021
laravel package for the Ar-PHP Project

laravel package for the Ar-PHP Project this is just a wrapper to use with laravel for the Ar-PHP Library, for more details checkout khaled-alshamaa

ATM-code 20 Dec 21, 2022
A laravel service provider for the netsuite-php library service

netsuite-laravel A PHP supplemental package to the ryanwinchester/netsuite-php package to add the NetSuite service client to the service container of

NetsuitePHP 6 Nov 9, 2022
Simplest Slugify for PHP to convert string into a slug.

Simplest Slugify for PHP to convert string into a slug. Documentation You can find the detailed documentation here in Slugify Documentation. Contribut

Pharaonic 6 Mar 12, 2022
PHP package to help the development of Laravel-based Telegram bots

Laravel-telegram-bot Project description goes here. This description is usually two to three lines long. It should give an overview of what the projec

CC - UFFS 6 May 10, 2021
Deploy and execute non-PHP AWS Lambda functions from your Laravel application.

Sidecar for Laravel Deploy and execute non-PHP AWS Lambda functions from your Laravel application. Read the full docs at hammerstone.dev/sidecar/docs.

Hammerstone 624 Dec 30, 2022
Laravel blade directives and php helpers for serverside rendered content, based on browser window size WITHOUT css

Laravel Window Size and Breakpoints Laravel blade directives and php helpers for server side rendered content, based on browser window size WITHOUT cs

Tina Hammar 7 Nov 23, 2022
Send PHP errors to Flare

Send PHP errors to Flare This repository contains a PHP client to send PHP errors to Flare. Documentation You can find the documentation of this packa

Spatie 64 Dec 26, 2022