Skip to content

Instant thumbnail maker for the images to use in views

License

Notifications You must be signed in to change notification settings

A-H-Pooladvand/php-thumbnail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Thumbnail

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

Requirements

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

Installation

composer require ahp/thumbnail

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

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

Parameters

  • 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

Examples

// 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) ?>">

License

PHP Thumbnail is licensed under the MIT License.

Copyright 2019 Amirhossein Pooladvand

About

Instant thumbnail maker for the images to use in views

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages