-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use Flask_Images with a document api endpoint? #31
Comments
I think you will be running into the same issue as #13, in that this project currently requires the images to actually exist on disk. There isn't an absolute requirement for that, so we've been throwing around the idea of abstracting the IO such that one could load/cache images anywhere. |
It is quite inelegant, but Flask-Images may be able to make HTTP requests of itself for images. You could provide an endpoint that serves image data that is only accessible from localhost. It would end up downloading and caching a copy of every image (by default), and you would lose the cache-busting features. Tell me more about your use case? |
@mikeboers I guess what you're suggesting in your second post is to use the external option in I am now thinking it would be something like this:
Would you have a suggestion of how I would be able to make that local http request? And also: are you planning on implementing some of your IO-abstraction ideas in the near future or is that more of a long term plan? The website I'm building will probably be going live in about two months, so if this is something coming soon I would be happy to wait and maybe help out where I can so that I can use your (for the rest awesome!) plugin.. :-) |
What I was suggesting would be a way to hack this system into working, but it would still result in a full copy of the image existing on disk (except that Flask-Images would manage it). This IO abstraction isn't currently on my roadmap, as none of my current work comes near it. If your project enabled you to hire me to implement this, I could likely shift some things around to make it work. |
@mikeboers Your code and your suggestions in this thread have been a great inspiration though. Do you have a Bitcoin address where I can send you some beers? |
I now have flask_images working flawlessly for static images with the following code:
I now want to use it for my dynamic document endpoint which gets images from a MongoDB instance. It is defined in Flask like this:
So normally I create urls for an image using getDoc like this;
How would I convert this to use flask_images for resizing? All tips are welcome!
The text was updated successfully, but these errors were encountered: