Skip to content

allixsenos/php-imageresizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

use via .htaccess mod_rewrite rules:
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*\.jpg).([0-9x]+)px.jpg$ bin/resizer.php?from=$1&res=$2 [L,NC]

then calling
    http://yoursite/images/foo.jpg.700px.jpg
will load the 700px wide version of the image

the script will save the result back to images/foo.jpg.700px.jpg so the next time the URL is
requested, it will go straight to the actual file, skipping the PHP script invocation

supported size params:
    700px - 700px wide - scale resize
    x300px - 300px tall - scale resize
    700x300px - scale & crop optimally (hopefully) to produce EXACTLY 700x300px image

REQUIRES Imagick's convert app

CONFIGURATION
 - make sure $approot is correct
 - make sure you have /usr/bin/convert
 - make sure the RewriteRule has the correct path to the script
 - adjust $nice to suite your needs (the default 10 should ensure resizer doesn't hog the spotlight)

About

on the fly image resizer/cropper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages