joelmap / geohashdroid

Automatically exported from code.google.com/p/geohashdroid
0 stars 0 forks source link

When attempting a picture upload twice, don't upload the picture twice. #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Upload picture
2. Fail when updating gallery
3. Try again

What is the expected output? What do you see instead?

The application should remember that the image upload succeeded and use the 
previous file name to update the expedition page.

Original issue reported on code.google.com by thomas.h...@gmail.com on 14 Dec 2013 at 11:41

GoogleCodeExporter commented 9 years ago
Hm... I think I might have a simple way I can pull this off, next time I have a 
chance to look through the code.  But yeah, if I recall, I do assign a unique 
name to each upload based on the current time, and I can change that such that 
the same file to the same graticule by the same user will give the same name on 
the server.  I'll look into that soon.

Original comment by captains...@gmail.com on 16 Dec 2013 at 12:18

GoogleCodeExporter commented 9 years ago
You could assign the filename when the picture is first selected, or
even use the picture time stamp for the picture file name directly.
That can be independent of the timestamp in the message even.

Original comment by thomas.h...@gmail.com on 16 Dec 2013 at 12:27

GoogleCodeExporter commented 9 years ago
What I was thinking was naming the file something like 
[wiki_username]-[date_and_graticule]-[original_filename].jpg.  That should 
ensure that the filename remains the same each time it's uploaded, and it can 
check to see if it exists on the wiki before re-uploading (or just overwrite 
the old version).

If it works like that, it might also check to see if the gallery section 
already has the image and skip that step if it does.

Original comment by captains...@gmail.com on 16 Dec 2013 at 2:38

GoogleCodeExporter commented 9 years ago
Okay, I've decided on [expedition]_[wikiname]_[file timestamp].jpg as the 
filename.  That SHOULD make it reasonably unique unless the user is 
intentionally submitting files with bogus timestamps.  It'll first see if a 
file by that name exists, and if it does, it skips the entire scale-and-upload 
phase.  If it also finds that filename in the page text (that is, it was 
already added to the gallery), it'll skip that step, too.

I've got the check-for-existence method in WikiUtils already, so all I have to 
do is rearrange the logic in WikiPictureEditor such that it can smoothly branch 
off on those decisions.  I'm working on unraveling that right now.

Original comment by captains...@gmail.com on 27 Dec 2013 at 1:35

GoogleCodeExporter commented 9 years ago
Got it.  On the master branch, there's now some changes that'll check to see if 
the image was already uploaded before doing the resize-and-upload phase of wiki 
posting.  That'll go into a new version once it's ready.

However, further investigation tells me I should fix a couple more things 
involving picking images before I release a new version, so you'll have to 
build a new version if you want to use this right away.

Thanks for the feature suggestion, though!

Original comment by captains...@gmail.com on 1 Jan 2014 at 3:49