jeffalo / scratch-image-uploader

Use Scratch project thumbnails to upload images to be used on the forums.
10 stars 3 forks source link

Use raw.githubusercontent.com instead of a data URL #20

Closed BoomerScratch closed 4 years ago

BoomerScratch commented 4 years ago

Resolves #3 This uses raw.githubusercontent.com instead of a data URL. When using a data URL, the browser only has to base64 decode the image, making it load faster. When you use raw.githubusercontent.com, it needs to request the image and wait for a response, making it take longer to load. That should make the buttons look like they load at the same time.

I was unable to test this, because well, you know. If you want to test this, merge this PR, and test it. If it doesn't work, don't worry! Simply revert this pull request. If the image of the button doesn't work, wait for some time and try again (because of the server speed).

jeffalo commented 4 years ago

i wonder if this'll break @easrng's userstyle which adds material forum buttons.

also i mean, it's a tiny base64 encoded image, it could take longer to fetch the github url. but i dont know. i'll add a needs discussion label.

BoomerScratch commented 4 years ago

@JeffaloBob This is how the loading looks like with this PR merged: Looks good to me, right? You should hard refresh when testing it. It becoming wider is the userscript timing (because I use the userscript).

jeffalo commented 4 years ago

how about when the data urls are used?

BoomerScratch commented 4 years ago

@JeffaloBob Then the button loads about a second earlier.

jeffalo commented 4 years ago

@JeffaloBob Then the button loads about a second earlier.

wait earlier? or later im confused lol

BoomerScratch commented 4 years ago

@JeffaloBob:

easrng commented 4 years ago

i wonder if this'll break @easrng https://github.com/easrng's userstyle which adds material forum buttons.

also i mean, it's a tiny base64 encoded image, it could take longer to fetch the github url. but i dont know. i'll add a needs discussion label.

It won't break it. Why change this though? With a data URL, it downloads once, with the userscript, while if you host it, it downloads every time.

On Sat, Aug 1, 2020, 12:47 PM Boomer001 notifications@github.com wrote:

@JeffaloBob https://github.com/JeffaloBob:

https://user-images.githubusercontent.com/60622217/89106092-48e4f900-d427-11ea-999d-31fb74f70099.gif

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JeffaloBob/scratch-image-uploader/pull/20#issuecomment-667558213, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQENBYD5JFYZB3AJZQQRZ3R6RBIRANCNFSM4PNS6SOA .

jeffalo commented 4 years ago

yeah i think this might end up being slower/less reliable than a data url so i dont think we need it sorry :(