Resize image in static directory of Blogdown site

I am trying to resize an image in the static directory.

I am trying to resize an image, in particular one in the static/_media/ directory.

For example, on a page on my Hugo site, I added the following two lines to the top of the .md file:

![test image](/_media/logos/pdf_100100.png)

![test image 2](/_media/logos/pdf.png)

The first is resized to have dimensions of 100 x 100 pixels, while the second is 720 x 720. However, they both render the same size. How can I resize an image - either outside of or within Blogdown?

Note: I asked two related questions on Stack Overflow on the topic (here, here), and the consensus seems to be that you cannot resize them without the use of shortcodes. I also have a question / issue on GitHub; I wouldn't normally post here this quickly but am under a bit of a time-crunch. Separate from the issue of how to resize an image, I'm confused why images with different dimensions appear as the same size, as the two images on the page linked above are.

Thank you for any help.

I usually just use straight HTML, namely the img tag. Here's an example: https://github.com/rbind/edgarsdatalab/blob/master/content/post/intro-to-tfestimators.Rmd#tensorboard

<img src = "/post/intro-to-tfestimators/tensorboard.png", width = "850", height = "400">

2 Likes

Perhaps related to the style setting, issue, it looks like removing the comma, i.e. changing this from:

<img src = "/_media/logos/pdf.png", width = "15", height = "200">

to:

<img src = "/_media/logos/pdf.png", width = "15" height = "200">

fixed this issue

This is usually because there's an overriding style setting, probably a min-width somewhere in the resulting html. Check out the resulting page source to see if you something like that is setup. If it is, then probably one of your theme components have it set.

1 Like