GithubHelp home page GithubHelp logo

resimagecrop's Introduction

resimagecrop - RESS based solution for cropping images for responsive design

Purpose

There are many solutions out there for responsive images, and this is just another one.

Disclaimer

This is most definitely a work in progress and lots of things can be done to improve it. Take it as a "proof of concept"

Features

  • RESS based
  • Allows cropping of images based on percentage x and y co-ordinates to aid art direction
  • Images can also be scaled
  • Created images are saved to aid caching (thanks to @tadywankenobi)
  • MIT license

Installation

  • Place resimagecrop.php in the root directory of your website (or anywhere else to be honest).
  • Use it.

Usage

Use resimagecrop.php in the src attribute of an img element with the following parameters:

  • image the relative link to the original local image file
  • x the percentage x co-ordinate value within the original image where a crop should begin
  • y the percentage y co-ordinate value within the original image where a crop should begin
  • w the pixel width of the original image that is to be cropped
  • h the pixel height of the original image that is to be cropped
  • sc the decimal scaling factor of the resulting image

Examples

<img src="resimagecrop.php?image=img/saumur-castle-loire-valley-france.jpg&x=15&y=20&w=550&h=450" alt="A view of Saumur Castle in the Loire Valley in France" />

This is interpreted as: Take image img/saumur-castle-loire-valley-france.jpg and begin cropping it with dimensions 550x450 pixels, beginning from 15% from the top and 20% from the left.

<img src="resimagecrop.php?image=img/saumur-castle-loire-valley-france.jpg&x=15&y=20&w=550&h=450&sc=0.2" alt="A view of Saumur Castle in the Loire Valley in France" />

This is interpreted as: Take image img/saumur-castle-loire-valley-france.jpg and begin cropping it with dimensions 550x450 pixels, beginning from 15% from the top and 20% from the left, and scale the resulting image by a factor of 0.2 (20%).

Recommendations

It is recommended to use this in conjunction with something like Scott Jehl's picturefill script which will allow you to specify different images for different media queries.

Demos

Known Issues

  • Currently only returns JPGs
  • Doesn't save image file and therefore caching is not facilitated
  • Probably lots of other stuff that you clever people will notice and point out to me.

resimagecrop's People

Contributors

iandevlin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

resimagecrop's Issues

Security contact

Hello maintainer(s),

I am a security researcher from the Institute of Application Security at TU Braunschweig, Germany. We discovered a (potential) security vulnerability in your project.

We would like to report this vulnerability to you in a responsible and ethical manner.
Therefore, we do not want to disclose any details of the vulnerability publicly until you have had a chance to review and fix it.

Could you please let us know your prefered way of receiving security reports?

You can contact us at [email protected] or by replying to this issue.

Thank you for your attention and cooperation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.