Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resize image in static directory #243

Closed
jrosen48 opened this issue Jan 8, 2018 · 3 comments
Closed

Resize image in static directory #243

jrosen48 opened this issue Jan 8, 2018 · 3 comments
Milestone

Comments

@jrosen48
Copy link

@jrosen48 jrosen48 commented Jan 8, 2018

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. 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!

@yihui
Copy link
Member

@yihui yihui commented Jan 11, 2018

I don't see any images on the page you mentioned: https://jrosen48.github.io/teaching/

@jrosen48
Copy link
Author

@jrosen48 jrosen48 commented Jan 11, 2018

Sorry, I just added them back. I added a few other versions (associated with these lines) on this page here:

![test image](/_media/logos/pdf_100100.png)
![test image 2](/_media/logos/pdf.png)
<img src = "/_media/logos/pdf.png", width = "40" "height = "200">
<img src = "/_media/logos/pdf.png" width = "40" "height = "40">
<img src = "/_media/logos/pdf.png" width = "40">
<img src = "/_media/logos/pdf.png" height = "40">
<img src = "/_media/logos/pdf.png"  style="width: 40; height: 40;">

@yihui
Copy link
Member

@yihui yihui commented Jan 12, 2018

It seems every time when I'm ready to look at your page, the images are gone... It will be great if you could make a reproducible example and keep it there for at least a few days. It does not have to be the homepage. It could be a temporary page that no other people would see.

Sorry I'm afraid I cannot spend more time on this issue (too much other work to do), but here is the section to teach you "how to fish": https://bookdown.org/yihui/blogdown/website-basics.html I hope you can figure it our by yourself (my guess is that your CSS defined the width or max-width of img). If you have further questions, StackOverflow usually is the better place to go. Thanks!

@yihui yihui closed this as completed Jan 12, 2018
@yihui yihui added the question label Jan 12, 2018
@yihui yihui added this to the v0.5 milestone Jan 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants