-
Notifications
You must be signed in to change notification settings - Fork 0
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
richard/imageHash #89
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
When I said "use an image hash" I meant that the image URL becomes /api/image/<hash>. The card ID should no longer be used because in the event that more than one card uses the same image, the image hash will be identical, and a single fetch by the browser can cover all cases with its cache. |
But this does work though? with less changes for the API? For api/image/hash, we'd have to search the entire card collection, a lot more work for the server in my opinion. Alternatively image will no longer be associated with card, so they'll have their own collections. And imageHash should probably be replaced by image id. This does mean we no longer search the entire collection for every fetch, but every upload the server will check the hash against every single image in the database. Unsure if this is worth the improvement in UI. |
I think we should keep the image to card association. The GET /image endpoint also needs to check the authorisation of whether the user owns the card the image belongs to. This can be done within the transaction code, however it still means that we need to fetch the card record the imagehash falls under. Currently the improvement is front-end centric and the goal is to ensure that the Image component makes the calls whenever an image is changed and a new url is loaded into the component. |
I agree with walter. I'll list the (what i think is the) pros and cons here: We do what I did here: pretty much nothing changes, hash is only used by the front-end to get browser to behave. We do /api/image/hash: two options: options no 2, image unassociate with cards. Every card will have an imageId with it. Sever scan for identical hash on every upload to save space (or alteratively not, but in that case you might as well keep the association). Server will also still have to check if user can access image, this means image will have a list of user's foreign keys. |
You are correct, and the MD5 hash is susceptible to this. Use the |
Neither options are good. There is one easy way to do it. Have every card store its |
So basically the first option? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor change, then it should be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
speed baby.
Thanks to a certain person's good coding style that he went on to forget about during the meeting.
closes #76.
pre-apologize for any mistake I might have made. pls check.