Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Responsive image resizing via PHP, GD, Javascript
PHP JavaScript CoffeeScript CSS
Branch: master

Tidy up JS

latest commit cd6f312869
Gavyn McKenzie authored
Failed to load latest commit information.
css Initial commit
img Initial commit
js Tidy up JS
less Initial commit
php/lib Initial commit
.gitignore Initial commit
README.md Initial commit
index.html Remove CoffeeScript and Jade in favour of native
resize.php Tidy up JS

README.md

Crispy resize

Crispy resize is a responsive images plugin that uses PHP-GD and ajax to lazy load the correct image size for the display width.

Requirements:

How to use

Add the resize-class.php in php/lib/ to your php libs folder. Add resize.php in the root to your web root.

Set your potential image display sizes in the array at the top of resize.php and the path to the cache folder.

Include the resize.js plugin in /js/ on your page.

Set the breakpoints at which you want to refresh the image in resize.js (or resize.coffee if you want to compile the plugin.)

Replace your <img> tags with the following html:

<div data-src="[put your image src here]" data-alt="crispy" class="img-wrap js-crispy">
    <noscript><img src="[put your image src here]" alt="Crispy"></noscript>
</div>

Add some CSS to size your img-wrap element and make sure the image within it fills it.

.img-wrap {
  display: inline-block;
  width: 10em;
}
.img-wrap img {
  max-width: 100%;
  display: block;
  width: 100%;
}

Done!

Something went wrong with that request. Please try again.