nitcalicut / Paathshaala

Social Content Repository for NITC
www.paathshaala.nitc.ac.in
GNU General Public License v3.0
12 stars 7 forks source link

Error images #20

Closed jaseemabid closed 12 years ago

jaseemabid commented 12 years ago

Error image handling should be moved to server side. The current method alters the the source attribute of images with JavaScript once a 404 is detected. This is a serious performance killer. Waiting for the broken images makes the page load really slow. Also, this is error prone since, jQuery seems to miss a few event triggers, leading to broken ui.

jaseemabid commented 12 years ago

Considering duplicating default image in the required place. Its just 11 kB and seems like the best option to me.

nxvipin commented 12 years ago

Considering duplicating default image in the required place. Its just 11 kB and seems like the best option to me.

Its better in db. How do you change default image if you want to?

Regards, Vipin Nair, National Institute of Technology, Calicut http://gplus.to/swvist

jaseemabid commented 12 years ago
    | Its better in db. How do you change default image if you want to?

I would not prefer DB. Have to see implementation details before coming into a conclusion though. String lengths are too long after converting to Data URI. And we can always replace files with newer ones if we want to. Or even go for an annotated file name structure. Say Orig.1 ?

See SHA: 91e4b8c2ef845ba6b82fe831af2e2d002691b631. Its a small exp with Data URI. A 'null image' (a transparent placeholder) was a 236 char long string. Orig size : 175 bytes. I still wonder if saving images as Data URI strings in DB is a good option. A video from YUI Theater on the topic.

jaseemabid commented 12 years ago

DataURI gives a string 130% size of the original image.

nxvipin commented 12 years ago

Fixed. Changed DB structure. Added a Boolean field us_pic for user pic. A check is performed before an user pic URL is generated. All possible optimization (Including query reduction) applied wherever possible. Issue closed. Refer the following commits for all the changes: 3979968994e40ee18bd3554d9309942739a99e92, 615100681384e62214a416ef95083941b808eba7, 81d93da7882c2ab9fd06bd38fe1e9a79abaa185d, 9082f3dcebcfd833104add965141661c3c850f30