Instant thumbnail maker for the images to use in views

dev-master 2019-05-01 12:29 UTC

This package is auto-updated.

Last update: 2020-07-30 01:38:30 UTC


PHP Thumbnail is a PHP image manipulation library providing an easier and expressive way to create thumbnails to improve SEO of your website.

What it can do?

  • Cropping image
  • Resizing image
  • Fitting image
  • Changing quality of image
  • Change width and height of image

Getting started


  • PHP >=7.1
  • intervention/image ^2.4@dev


composer require ahp/thumbnail

Once installed you can use it
// Via helper function
img($path, $width, $height, $mode, $quality)
// Via class
\Thumb\Thumb::make($path, $width, $height, $mode, $quality)

afterward thumbnail will be create in same directory of given path named thumbnail


  • path : Path of image string|required
  • width : Desired width int|null
  • height : Desired height int|null
  • mode: one of fit or resize or crop
  • quality : Quality of image int|null = 100


// Using img() helper function
<img src="<?= img($path, $width, $height, $mode, $quality) ?>">

// Full example
<img src="<?= img('files/animals/koala.jpg', 500, 200, 'crop', 50) ?>">

// we can ommit width or height but one of them is required to calculate it from other one
<img src="<?= img('files/animals/koala.jpg', 500) ?>">

// OR
<img src="<?= img('files/animals/koala.jpg', null, 200) ?>">


PHP Thumbnail is licensed under the MIT License.

Copyright 2019 Amirhossein Pooladvand