alex9311 / information-retrieval

TU Delft, Masters Software Technology, Information Retrieval, 3rd Quarter 2015
1 stars 2 forks source link

added random prefix to image #59

Closed alex9311 closed 9 years ago

alex9311 commented 9 years ago

Hey @millenniumproof

I ended up using a random 4-digit number instead of image ID. This is a bit ugly but we dont know the image ID when we are setting the image file name. It would be possible to get it but this is much much easier.

Let me know what you think! I tested it and it works :neckbeard:

alex9311 commented 9 years ago

oops just realized I still need to implement allowing upload without image

alex9311 commented 9 years ago

got it!

millenniumproof commented 9 years ago

It's not a proper solution, but if it works it's good enough for a prototype. I only have a few images on my computer so it was getting annoying when I wanted to test submitting. Had to rename the files. Bet there's a lot of junk images on the server now :P

alex9311 commented 9 years ago

Yeah. Well i was thinking you could still run into duplication if you use image id to prefix the image name.

If your DB used to have image birds.jpg on idea number 1, if you try to use that same image for image number 1 after resetting 1_birds.jg will already exist.

What we really want to do is wipe the upload directory on the server when we reset the DB. But like you said, this solution works for our purposes.

alex9311 commented 9 years ago

actually let me just implement wiping the uploads directory

millenniumproof commented 9 years ago

Sure!

alex9311 commented 9 years ago

do you mind if i reset the DB to test it?

millenniumproof commented 9 years ago

No problem.

alex9311 commented 9 years ago

Seems to work! Still using randomly generated ints but at least this keeps the server clean. Should I merge it in?

millenniumproof commented 9 years ago

Go ahead (^-^)b