-
Notifications
You must be signed in to change notification settings - Fork 140
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
No way to add pictures to the cache and a source? #15
Comments
An EGOPhoto object can take file URL's, you should store the image to disk after the user selects it, then pass the URL to the photo source. As far as being immutable after the photo view is presented, would you like a method to add a EGOPhoto to the photo source at anytime? |
Hi. Devin. Thanks for your response. A file URL won't prevent the image from unnecessarily being re-downloaded from the Web when it's already in the cache, so I moved keyForURL into the EGOImageLoader header file; now I can call it from elsewhere to create hashed URLs for my locally acquired (and uploaded) files that will match subsequent attempts to retrieve them from a server with a URL. This works fine; I verified that newly taken pictures are pulled from the cache instead of re-downloaded on subsequent views. And yes, I'd like a way to add a photo to a photo source at any time, so if I'm displaying the collection in a UI, the new photo gets added. In my copy of the code, I changed EGOPhotoSource's array into a mutable one and added an addPhoto: method. Now I need to figure out how to get existing views to reload from the PhotoSource. Does this sound reasonable? |
I have all of this working in my project. I made note of the changes to EGO (which were relatively minor) so I can contribute them back after I'm done testing. |
There doesn't seem to be a way to update a PhotoSource with a new photo; the internal array is immutable, so even subclassing doesn't help. For example: You have a downloaded collection of photos and then the user takes a new picture and your app uploads it. Obviously you don't want to re-download the picture just to add it to the cache; you want to add it directly from memory.
Adding this locally taken picture to the cache isn't practical right now for another reason: keyForURL (which generates the hashed key used to tag images in the cache) resides in EGOImageLoader.m. Shouldn't this at least be in the header file instead, so client apps can use it?
Or am I missing some existing ways in which images can be added directly to the cache and photo sources?
The text was updated successfully, but these errors were encountered: