Button for embedding images from Google Drive

Started by toretorden, June 28, 2023, 02:05:55 PM

Previous topic - Next topic

toretorden

Hi there, folks!

So, my preferred way of hosting images for embedding on my forum is currently to upload them to google drive and embed them from there.

I can share files on Google drive and then share a link to them. A link might look like this:

https://drive.google.com/file/d/1XneYbFsdVgELqLGwTgOvIcsZ_11-ry1L/view?usp=drive_link
In order to embed it on my forum, I have to make the following changes:

https://drive.google.com/uc?id=1XneYbFsdVgELqLGwTgOvIcsZ_11-ry1L
The changes are:

  • The "/view?usp=drive_link" suffix is removed
  • the "file/d/" part is swapped for uc?id=

The modified URL can be embedded with:

[img]https://drive.google.com/uc?id=1XneYbFsdVgELqLGwTgOvIcsZ_11-ry1L[/img]

Although it's not a lot of work manually changing this URL, I would prefer to have a quick button above posts that helps me do this quicker, much like the youtube button. Unfortunately, I haven't done modifications like this in SMF before.

Are anyone here able to guide me in this?

Which files need to be modified? Where should the code(s) be inserted? Will I need an image for a new button?

Advertisement: