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` to generate Flask-Images URLs #7

Closed iurisilvio closed 10 years ago

iurisilvio commented 10 years ago

Using url_for to generate Flask-Images URLs instead of a custom function. Use the route images (configurable with IMAGES_NAME).

e.g. url_for('images', filename='image.png', width=30, mode='crop')

I didn't removed the resized_img_src behaviour to maintain compatibility.

Close #5.

iurisilvio commented 10 years ago

I focused on the url_for, added some tests but didn't added a test runner or any test configuration to setup.py. Also, didn't added Flask-Testing dependency.

About the implementation, I had to use the url_for build error handler, because this URL is defined dynamically.

I'm not sure how to do it in setup.py, I have to learn about it, but you should care about tests, docs and everything, because it is an important plugin for Flask environment.

mikeboers commented 10 years ago

I thought I responded to this yesterday, lets try again!

I do care quite a bit about tests/docs/everything, and I could make excuses with regard to the history of the project, but I won't.

Instead, I'm currently fighting with PIL's dependencies to get Travis-CI to run your tests. =]

Once I have that, I'll release these 3 PRs as v1.1.0 (or similar).

mikeboers commented 10 years ago

This also responds to url_for('images.crop', ...) or any of the modes.

Released to PyPI as v1.1.0.

Cheers!

iurisilvio commented 10 years ago

No, it doesn't work this way. I created only the images route (based in IMAGES_NAME).

It is really easy to create these other routes, but I preferred to make it simple for the first patch, the way resized_img_src works.

mikeboers commented 10 years ago

It does, because I added it. =P