2017 © Pedro Peláez
 

library simple-image

A simple image resize tool that takes all the pain out of resizing images for the web.

image

hiperbola/simple-image

A simple image resize tool that takes all the pain out of resizing images for the web.

  • Friday, August 21, 2015
  • by naxez7
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

SimpleImage

A simple image management system for resizing various images., (*1)

For a long time, I struggled with various image sizes. Thumbnails, preview images and any other nonsense resizing must be performed when undertaking the production of any website. Although tools do exist to simplify this, I found that setting them up would often take longer than doing the resizing manually. So I decided to try to make a very simple, easy to implement image system, that handles all the resizing for me. With the introduciton of the HTML5 tag, the need for this is even greater, as you need several different image sizes for each image you put on your website to keep loading times reasonable and to maintain responsivness., (*2)

Installation

Install with composer using composer require hiperbola/simple-image., (*3)

The package comes with 2 files that are important. The .htaccess file and the bootstrap.php file., (*4)

The .htaccess file is the apache config file that redirects all supported image file requests the the bootstrap.php file. Move the .htaccess file to your root directory of your webpage, or if you already have an apache configuration file, in which case you can open the given htaccess file and copy the rewrite rule to your exising configuration file. Also, since composer installs packages into the vendor folder, you will need to modify the rewrite rule so it points to the valid bootstrap.php file., (*5)

Usually this will do just fine, if your .htaccess file is in your root directory. RewriteRule ^(.*)\.(jpg|png) vendor/hiperbola/simple-image/bootstrap.php/$1 [L], (*6)

Usage

After you've correctly installed the package, there really isn't much more to do. When linking to an image on your webhost simply append the parameters you would like to have applied. Currently, there are 3 modes of operation:, (*7)

Resize by height

Keep the aspect ratio and specify a new height., (*8)

E.g. url/image.jpg/h:400px, (*9)

Resize by width

Keep the aspect ratio and specify a new width., (*10)

E.g. url/image.jpg/w:800px, (*11)

Resize by width and height

This will not keep the aspect ratio but stretch the image to satisfy the parameters., (*12)

E.g. url/image.jpg/w:400/h:400, (*13)

Notes

You may be worried that image processing takes a long time, and under a heavy load this could become a major problem. This system uses a cache system, where any image that has been generated will be stored on disk so every dimension you request will be generated only once. The 'cache' is a small mysqlite database so no external database access is necessary., (*14)

The Versions

21/08 2015

dev-master

9999999-dev

A simple image resize tool that takes all the pain out of resizing images for the web.

  Sources   Download

The Requires

  • php >=5.3.0

 

by Pavlin