2017 © Pedro Peláez
 

library imageresize

PHP class to resize images

image

innobotics/imageresize

PHP class to resize images

  • Sunday, April 1, 2018
  • by notesz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

Image resize

Install

You can install ImageResize by composer. Add this row to your composer.json., (*1)

{
    "require": {
        "Innobotics/ImageResize": "1.*"
    }
}

But do you want to include this pack use this:, (*2)

require_once '/path/to/Innobotics/ImageResize.php';

Usage

You should create an image object., (*3)

$image = new \Innobotics\ImageResize();

Add types. The type contains the key, and the image's size., (*4)

$image->setType('large', 640, 480);
$image->setType('medium', 320, 240);
$image->setType('thumbnail', 160, 120);
$image->setType('content', 500, null); // You can add 'null' as height. It won't be cropped.

Add the source file., (*5)

$image->setSource('/home/notesz/teszt/bianka_160117.jpg');

Add the target folder., (*6)

$image->setTarget('/home/notesz/teszt/resized');

If you don't like the original name, you can add a new filename. (It is optional), (*7)

$image->setFileName('bianka.jpg'); //optional

Would you like to set compression? Add this one: (It is optional, the default value is 75), (*8)

$image->setCompression(100); //optional

Would you like to set compression type? Add this one: (It is optional, the default value is 9) You can find types here: https://www.geeksforgeeks.org/php-imagick-setimagecompression-function/, (*9)

$image->setCompressionType(8); //optional

Would you like to use a file prefix? Add this one: (It is optional), (*10)

$image->setPrefix('image'); //optional

Would you like to disable progressive (setInterlace)? Add this one: (It is optional), (*11)

$image->setProgressive(false); //optional

Would you like to use retina sizes? Add this one: (It is optional), (*12)

$image->setRetina(true); //optional

If you don't want to save the original image you can disable it. Add this one: (It is optional), (*13)

$image->setSaveOriginal(false); //optional

Resize your image., (*14)

if ($image->resize() === true) {
    print 'It\s okay! :)';
} else {
    print 'Something happened!';
}

Then you can reach the result., (*15)

print_r($image->getResult());

If the resize was success, the result is:, (*16)

Array
(
    [status] => success
    [message] => Array
        (
            [files] => Array
                (
                    [large] => image_bianka_large.jpg
                    [medium] => image_bianka_medium.jpg
                    [thumbnail] => image_bianka_thumbnail.jpg
                    [original] => image_bianka.jpg
                )

        )

)

But the resize was false, the result is:, (*17)

Array
(
    [status] => error
    [message] => unable to open image `/home/notesz/teszt/IMG_790s7.jpg': No such file or directory @ error/blob.c/OpenBlob/2638
)

The Versions

01/04 2018

dev-master

9999999-dev https://github.com/innobotics/imageresize

PHP class to resize images

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *
  • ext-imagick *
  • ext-exif *

 

php image resize retina

01/04 2018

1.4

1.4.0.0 https://github.com/innobotics/imageresize

PHP class to resize images

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *
  • ext-imagick *
  • ext-exif *

 

php image resize retina

01/04 2018

1.3

1.3.0.0 https://github.com/innobotics/imageresize

PHP class to resize images

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *
  • ext-imagick *
  • ext-exif *

 

php image resize retina

09/11 2016

1.02.x-dev

1.02.9999999.9999999-dev https://github.com/innobotics/imageresize

PHP class to resize images

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *
  • ext-imagick *
  • ext-exif *

 

php image resize retina

09/11 2016

1.02.2

1.02.2.0 https://github.com/innobotics/imageresize

PHP class to resize images

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *
  • ext-imagick *
  • ext-exif *

 

php image resize retina

09/11 2016

1.01.x-dev

1.01.9999999.9999999-dev https://github.com/innobotics/imageresize

PHP class to resize images

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *
  • ext-imagick *
  • ext-exif *

 

php image resize retina

09/11 2016

1.01

1.01.0.0 https://github.com/innobotics/imageresize

PHP class to resize images

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *
  • ext-imagick *
  • ext-exif *

 

php image resize retina

25/10 2016

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/innobotics/imageresize

PHP class to resize images

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *
  • ext-imagick *
  • ext-exif *

 

php image resize retina

25/10 2016

1.0

1.0.0.0 https://github.com/innobotics/imageresize

PHP class to resize images

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *
  • ext-imagick *
  • ext-exif *

 

php image resize retina

25/10 2016

1.02

1.02.0.0 https://github.com/innobotics/imageresize

PHP class to resize images

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-gd *
  • ext-imagick *
  • ext-exif *

 

php image resize retina