Closed GoogleCodeExporter closed 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
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
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
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
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
Original issue reported on code.google.com by
thomas.h...@gmail.com
on 14 Dec 2013 at 11:41