Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
lilith committed Jul 7, 2013
2 parents da059aa + de7e3de commit eb49105
Showing 1 changed file with 46 additions and 7 deletions.
53 changes: 46 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,70 @@

Dual-licensed by Imazen under the [MIT](http://www.opensource.org/licenses/mit-license.php) and [Apache](http://www.apache.org/licenses/LICENSE-2.0.html) licenses.

`Install-Package Imazen.SlimResponse`

###What does it to?

SlimResponse looks through outgoing HTML for `<img>` tags with a `slimmage` class applied, such as

```html
<img class="slimmage" src="image.jpg?width=150" />

<img class="thisclass slimmage thatclass" src="image.jpg?width=150" />
```

or for "slimmage=true" in any image URL

```html
<img src="image.jpg?width=150&slimmage=true" />
```


It then adds the appropriate markup to allow [slimmage.js](https://github.com/imazen/slimmage) to turn them into responsive images.



### Requirements
* ASP.Net 4.0
* [ImageResizer](http://imageresizing.net)
* [slimmage.js](https://github.com/imazen/slimmage).


* [ImageResizer](http://imageresizing.net) must be [installed](http://imageresizing.net/docs/install)
* [slimmage.js](https://github.com/imazen/slimmage) must be included in your page's javascript.

### Spin it up quickly for a test!
* Use WebMatrix and fire it up on the "www"-folder, that's all!

* Use WebMatrix or VisualStudio (Open Web Site) and fire it up on the "www"-folder, that's all!

### Notes & Caveats

* This parses all outgoing HTML. This may increase CPU usage slightly.
* Outgoing HTML is only modified if a responsive image is present.
* SlimResponse may mess up invalid HTML even further during parsing/serialization.
* If you're only using responsive images in limited situations, an HTML helper that spits out [slimmage markup](https://github.com/imazen/slimmage) may be more appropriate.
* SlimResponse does not include the [slimmage.js](https://github.com/imazen/slimmage) javascript file, that's your responsibility.

### Your web.config file must have both ImageResizer and SlimResponse installed

```xml
<?xml version="1.0"?>
<configuration>
<system.web>
<httpModules>
<!-- This is for IIS5, IIS6, and IIS7 Classic, and Cassini/VS Web Server-->
<add name="ImageResizingModule" type="ImageResizer.InterceptModule"/>
<add name="SlimResponseModule" type="Imazen.SlimResponse.SlimResponseModule, Imazen.SlimResponse"/>
</httpModules>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<!-- IIS7+ Integrated mode -->
<add name="ImageResizingModule" type="ImageResizer.InterceptModule"/>
<add name="SlimResponseModule" type="Imazen.SlimResponse.SlimResponseModule, Imazen.SlimResponse"/>
</modules>
</system.webServer>
</configuration>
```

Thanks to [esn303](https://twitter.com/#!/esn303) for creating [ImageResizer.ResponsivePresets](https://github.com/mindrevolution/ImageResizer-ResponsivePresets) and being the inspiration behind this project.


This project is open to collaboration. **Fork. Push. Innovate.**



0 comments on commit eb49105

Please sign in to comment.