dyreschlock / schlock-website

Personal Website code to be run locally or generate a static website hosted through github pages.
http://theschlock.com/
0 stars 0 forks source link

Resolve Google Image further #62

Closed dyreschlock closed 1 year ago

dyreschlock commented 1 year ago

One of the things that fails for validation #7 are the Google Drive embedded links. All of those embed links hit Google Drive and redirect to the direct image. It would save a lot of a load time if we could get those redirect links and use the results directly on the page.

The would take one more step in the ★Regen process. After getting the Google Drive ID, the process would have to run those URLs and look at the redirect links and grab that URL.

Here's an example of the URL that we want: https://lh3.googleusercontent.com/drive-viewer/AAOQEOSE576R63MetzTgNFbDtG8EjrRJbGjJMldsRKVVkU0fAetAlrMf-vJpIOpCpFnT_qVAhOkn3kfjALHWEUgRFAxCtN6Shg

The easiest thing to do would probably be to buffer read the HTML contents and string search for lh3.googleusercontent, grab this URL, and store it on the Image object in the database.

dyreschlock commented 1 year ago

This could also solve the problem of image occasionally not loading on pages with lots of images

dyreschlock commented 1 year ago

This increases loading time CONSIDERABLY. Must implement

dyreschlock commented 1 year ago

This is necessary as older Google Drive image have never worked with the Google Drive implementation apparently.

dyreschlock commented 1 year ago

For every image, a webP image is generated. The background process now gets the Google ID of the webP file and stores that on the Image object. Every Google ID link is a redirect which causes longer load times, so I'm resolving that call into a preview image of the webP file. This is the Direct Link, and this is stored on the Image Object, too.

Doing this, all images now have modern links in Google Drive and work on the site. Additionally, by using the preview images, there are no redirects which increases in the loading time from more than 6 seconds down to 3.2 seconds.

Unfortunately, the image previews are all JPG files. We still need to figure out how to front face the webP files. This should decrease loading times even further.

dyreschlock commented 1 year ago

Most of those image previews are broken now because they are temporary files.

Maybe create a new github repository that only has images and possibly pay for hosting.

dyreschlock commented 1 year ago

Images are now being hosted through Github. All of the Google code can be removed.

dyreschlock commented 1 year ago

All google code has been removed.