Jump to content

how to re-size temporary image file and upload to mysql blob


merck_delmoro

Recommended Posts

1. Download composer.phar from http://getcomposer.org and drop it inside your project directory

2. Create a composer.json file:

 

{
  "require": {
    "imagine/imagine": "0.6.*@dev"
  }
}
3. Run $ /path/to/php composer.phar install in the terminal

4. Use the imagine library:

 

<?php

require_once 'vendor/autoload.php'

$imagine = new Imagine\Gd\Imagine();
$image = $imagine->open('/path/to/image');


$image
  // scale image to 50%
  ->thumbnail($image->getSize()->scale(0.5))
  // display as jpeg at 75%
  ->show('jpeg', array('quality' => 75));
Documentation can be found at http://imagine.readthedocs.org/en/latest/index.html

API is available at http://imagine.readthedocs.org/en/latest/_static/API/

the manual also mentiones a few simple but effective resize methods using GD or ImageMagic: http://php.net/manual/en/function.imagecopyresampled.php, which saves you installing an entire image manipulation library when you only need the 20 or-so lines of code of the resize function.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.