Image/Video Embedding (Centering, Link Through and Sizing) #1
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I've been experimenting with embedding images and videos on the site, as it's a commonly requested function in the preliminary discussions around the site. I've come up with the following for basic image linking, but I have two issues I can't figure out.
(Forgive me as I have a self-taught basic understanding of some HMTL and markdown.)
Image embed HMTL
<img src=”https://miro.medium.com/max/700/1*uAp4K4IuVOaJp6v4B99KSQ.jpeg”>
Image embed HTML (with size constraint, for images smaller than 800px wide)
<div style=”maxwidth: 100px”><img src=”https://miro.medium.com/max/700/1*uAp4K4IuVOaJp6v4B99KSQ.jpeg”></div>
Image embed HTML (with size constraint and link on click.)
The two things I can't figure out/am curious about are
<a href=
bypasses the standard /www stylisation that pops up for links by default on the site. I was wondering if there was a way to selectively bypass the /www stylization when using identifier based links, like the following example.[<div style="max-width:100px"><img src="https://www.gravatar.com/avatar/dd5a7ef1476fb01998a215b1642dfd07"></div>][identifier]
then at the end of the markdown
[identifier]: https>//https://www.gravatar.com/avatar/dd5a7ef1476fb01998a215b1642dfd07
It's not absolutely neccessary, if using the HTML
<a href=
is the effective workaround for avoiding the /www stylization that is totally fine, but I'm going to encourage people to use the identifier method for normal links to keep things organized, so I was just wondering if you had a workaround.Lastly the video embedding related question
So the last question was centering around video being embedded on the site. Using simple embed codes from vimeo or youtube I've gotten videos working on the site in a functional basic way.
The one unideal thing formatting wise is that the size in pixels of the embeds is manual, rather than adaptive to the width of the content column.
As such the videos do not fill the whole column and do not scale if the column is scaling. Which means that they do sometimes break the bounds of the column if the window size is quite low.
While it's an edge case that someone with that small of a monitor/monitor resolution would be an end user, if there was a relatively simple way to make the sizing of the video match the column width I'd be interested in knowing what that would entail.
If it would be very complicated to do, then it's alright, since my concern would also be whether I could easily teach it to the RAs that will be functioning as editors.
Thanks a TON for all your help Marcell!
i would propose to work on this following the sandpoints custom set of links already existing..
let me try to show that via few examples (from https://pages.sandpoints.org/camposud/spectre/adifferenzadelpresente/ or git repo: https://git.sandpoints.org/CampoSud/SpectreOfReflections)
this screenshot is made after this markdown syntax in the source file:
this follows the regular image link in markdown but it introduces few custom details:
bib:
for the bibliographic references and it asks for the ID of the book from the dedicated Sandpoints librarySouthern Question
) into the hyperlink to the library itemanother use of bibliographic custom link is made if you leave the square brackets empty like this:
which expands into a full citation like this:
following what is introduced with 'bibliograhic references' there's also a support for the internal links to other sandpoints pages.
CampoSud's
SpectreOfReflections
has this triadic structure:spectre::reflection::highlight
so here are few examples:was rendered after this markdown link:
the same reference/highlight is rendered into full title if the sqare brackets are left empty:
and here's how it looks like on the same page in different part of the text:
that syntax should work for any page in Sandpoints not only for the ones part of the triadic tiers hierarchy. so far, very often internal link would be the link to
editor
orauthor
pages..following the above comment i would like to introduce similar approach to video and images. and the reason why i would add prefix
image
even hugo already has support for images (via common markdown) is that if i do that i can introduce also better control of how the images would be then embedded into the page.hugo has support for (youtube, vimeo) videos via its shortcodes.
both of those are good enough for most of the hugo users.
my experience working with not typical hugo users is that introducing too many different syntax rules is a big obstacle.
i feel following the syntax i already introduced to sandpoints should be the way to go.
i would suggest we do something like this:
the same should go for the
videos
by replacing the prefiximage
in above example.that would allow me to make a support for the custom styling/embedding. we should discuss the syntax when we want to add styles like: centering or aligning to the left/right, resizing etc.
i like that if the video/images are added this way i can do things like image/video galleries which would keep the backlinks and any other metadata we want to introduce to the images and videos.
would that satisfy the needs explained in this issue?
I totally understand the utility of the custom links, and they are what I am telling people to use where relevant. (Pages on the same site like curriculum, topic and syllabus.)
In general I think whatever is simplest and best matches the other systems is a good choice. (i.e. keeping everything in the format of

and
should help users remember the syntax I think.) That way people more layman than myself will hopefully get used to the system as they format writings for it.So I am 100% behind that implementation.
If you can write into the default styling something that accounts for images that are bellow 800px that can make them scale 1:1 instead of filling the width of the column, I think that would work on it's own for 99% of cases. Otherwise let me know what you think would work in terms of giving end users control over styles. (As being mostly a layman myself I don't know what the syntax options would be for that.)
The video prefix matching the rest of imprementations

would also be great. Most users will definetly have an easier time copying the url from youtube/vimeo rather than having to get them to find the embed code option.If this also allows you to setup formatting for galleries I am sure someone will find that super useful in the future.
As a last question, I wanted to confirm, can the site host it's own images or do they need to be hosted elsewhere? I have thusfar assumed that images will need to be pulled from a seperate site. It's fine either way, I just wanted to confirm.
So in conclusion, yes I think the outlined solutions would satisfy the needs outlined!
Thanks!
there's an initial support for img and vid... in short:
img:
andvid:
as referenced earlier in this issue would expand into respected<img
and<video
html tags. right after:
would be its source path and then separated with spaces should list the html attributes coming into theimg
orvideo
html tags...the only difference so far with the rest of custom links is that in order to get spaces recognized one should place "less than"
<
and "greater than">
in the brackets following![]
. so it starts like this(<
and ends like this>)
. see the example above...So I think this sort of solution could work, at the moment it doesn't seem to work at least from me quickly trying it.
When tried with an image link, the image displays but isn't formatted. With a youtube link it gives me a no mime warning and doesn't display.
But if we can use it to properly constrain the size and center the image or video in the column this would be great.
I think the ideal solution, if possible, would be to make it so that the size adjustment for images and video would be automatic through some kind of site wide stylization. (So a user could use the img: or vid: code and the stylisation would happen without a need to manually set it via HTML tags.) I am sure I could teach people how to use the tags if this isn't possible, but I figured I would ask, since I doubt that 99% of users would be looking for any stylisation that deviates from the following.
Images:
Video:
Thanks again for your help on this Marcell!
(Hope your year is off to a decent start!)
youtube videos wouldn't work with video tag. i will make a youtube/vimeo embed as a separate approach.
will come back to this..
with an image it should be
style=
notstyle:
like in this commit:2ae814e1da
just realized the mistake was introduced with my example here in this thread. i edited the comment..
i made as default styling for images bigger than the div container to fit in and for smaller to stay centered and in its original dimensions. if one wants to change that it could go for what i proposed earlier...
Sorry for the wait on my reply, I saw your comments, that sounds great in terms of making the default styling to re-size "larger than column" images and to leave "smaller than column" images their default size while centering them.
I am a bit confused as to how to test this default stylisation though since I cannot seem to figure out the correct syntax to make this work...
I've tried out writing the image tag both in the manner you outlined in one of your previous comments:
This seems to just resize like the original stylisation if the image is smaller than column width and/or when the image is manually reduced with style= the image does not center.
I also tried using:
But this also seems to still respect the old styling.
Am I just completely missing what the proper syntax is to access the default stylisation? Sorry if that is the case.
But either way I totally agree on the approach you outlined above of having images scale one way if larger than column and another if smaller as a default style!