mikeboers / Flask-Images

On-demand resizing of images for Flask applications.
https://mikeboers.github.io/Flask-Images/
BSD 3-Clause "New" or "Revised" License
81 stars 43 forks source link

Use url_for instead of a custom function #5

Closed iurisilvio closed 10 years ago

iurisilvio commented 10 years ago

It is the way Flask do the magic.

url_for('images.resize', filename='/path/to/file.png', width=80)

You can even define the mode based on routes: images.fit, images.crop, ...

It is good because I can migrate from url_for('static', filename='/path/to/file.png') in a really easy way.

mikeboers commented 10 years ago

You again?! I love it.

Seems like a good idea. I'm not immediately familiar with any hooks in url_for for custom logic. Do you have a page I can look at?

Cheers!

iurisilvio commented 10 years ago

You just have to mount a blueprint with these routes (resize, crop, fit based in my initial idea).

I'll make a pull request to this one soon.