implement responsive image sizing for mr-worldwide posts (and all others going forward)

pull/2/head
Brian Picciano 6 years ago
parent b3e56a081c
commit 5cfce76ac1
  1. 8
      _config.yml
  2. 28
      _drafts/mr-worldwide-pt-1-europe.md
  3. 24
      _includes/image.html
  4. 10
      _posts/2018-09-20-mr-worldwide-pt-0.md
  5. BIN
      img/mr-worldwide/1000px/denver-2017.jpg
  6. BIN
      img/mr-worldwide/1000px/granada-2018-0.jpg
  7. BIN
      img/mr-worldwide/1000px/granada-2018-1.jpg
  8. BIN
      img/mr-worldwide/1000px/kyoto-2017.jpg
  9. BIN
      img/mr-worldwide/1000px/lisbon-2018.jpg
  10. BIN
      img/mr-worldwide/1000px/loadout-packed.jpg
  11. BIN
      img/mr-worldwide/1000px/loadout-unpacked.jpg
  12. BIN
      img/mr-worldwide/1000px/madrid-2018.jpg
  13. BIN
      img/mr-worldwide/1000px/munich-moosach-2018.jpg
  14. BIN
      img/mr-worldwide/1000px/munich-victory-gate-2018.jpg
  15. BIN
      img/mr-worldwide/1000px/notebook.jpg
  16. BIN
      img/mr-worldwide/1000px/sagrada-familia-inside-2018-0.jpg
  17. BIN
      img/mr-worldwide/1000px/sagrada-familia-inside-2018-1.jpg
  18. BIN
      img/mr-worldwide/1000px/sagrada-familia-inside-2018-2.jpg
  19. BIN
      img/mr-worldwide/1000px/sagrada-familia-inside-2018-3.jpg
  20. BIN
      img/mr-worldwide/1000px/sagrada-familia-outside-2018-0.jpg
  21. BIN
      img/mr-worldwide/1000px/sagrada-familia-outside-2018-1.jpg
  22. BIN
      img/mr-worldwide/1500px/denver-2017.jpg
  23. BIN
      img/mr-worldwide/1500px/kyoto-2017.jpg
  24. BIN
      img/mr-worldwide/1500px/lisbon-2018.jpg
  25. BIN
      img/mr-worldwide/1500px/loadout-packed.jpg
  26. BIN
      img/mr-worldwide/1500px/loadout-unpacked.jpg
  27. BIN
      img/mr-worldwide/1500px/madrid-2018.jpg
  28. BIN
      img/mr-worldwide/1500px/munich-moosach-2018.jpg
  29. BIN
      img/mr-worldwide/1500px/munich-victory-gate-2018.jpg
  30. BIN
      img/mr-worldwide/1500px/notebook.jpg
  31. BIN
      img/mr-worldwide/2000px/kyoto-2017.jpg
  32. BIN
      img/mr-worldwide/2000px/loadout-packed.jpg
  33. BIN
      img/mr-worldwide/2000px/loadout-unpacked.jpg
  34. BIN
      img/mr-worldwide/2000px/madrid-2018.jpg
  35. BIN
      img/mr-worldwide/2000px/munich-moosach-2018.jpg
  36. BIN
      img/mr-worldwide/2000px/munich-victory-gate-2018.jpg
  37. BIN
      img/mr-worldwide/2000px/notebook.jpg
  38. BIN
      img/mr-worldwide/2500px/kyoto-2017.jpg
  39. BIN
      img/mr-worldwide/2500px/loadout-packed.jpg
  40. BIN
      img/mr-worldwide/2500px/loadout-unpacked.jpg
  41. BIN
      img/mr-worldwide/2500px/madrid-2018.jpg
  42. BIN
      img/mr-worldwide/2500px/munich-moosach-2018.jpg
  43. BIN
      img/mr-worldwide/2500px/munich-victory-gate-2018.jpg
  44. BIN
      img/mr-worldwide/2500px/notebook.jpg
  45. BIN
      img/mr-worldwide/3000px/kyoto-2017.jpg
  46. BIN
      img/mr-worldwide/3000px/loadout-packed.jpg
  47. BIN
      img/mr-worldwide/3000px/loadout-unpacked.jpg
  48. BIN
      img/mr-worldwide/3000px/madrid-2018.jpg
  49. BIN
      img/mr-worldwide/3000px/munich-moosach-2018.jpg
  50. BIN
      img/mr-worldwide/3000px/munich-victory-gate-2018.jpg
  51. BIN
      img/mr-worldwide/3000px/notebook.jpg
  52. BIN
      img/mr-worldwide/500px/denver-2017.jpg
  53. BIN
      img/mr-worldwide/500px/granada-2018-0.jpg
  54. BIN
      img/mr-worldwide/500px/granada-2018-1.jpg
  55. BIN
      img/mr-worldwide/500px/kyoto-2017.jpg
  56. BIN
      img/mr-worldwide/500px/lisbon-2018.jpg
  57. BIN
      img/mr-worldwide/500px/lisbon-escher-2018-0.jpg
  58. BIN
      img/mr-worldwide/500px/loadout-packed.jpg
  59. BIN
      img/mr-worldwide/500px/loadout-unpacked.jpg
  60. BIN
      img/mr-worldwide/500px/madrid-2018.jpg
  61. BIN
      img/mr-worldwide/500px/munich-moosach-2018.jpg
  62. BIN
      img/mr-worldwide/500px/munich-victory-gate-2018.jpg
  63. BIN
      img/mr-worldwide/500px/notebook.jpg
  64. BIN
      img/mr-worldwide/500px/sagrada-familia-inside-2018-0.jpg
  65. BIN
      img/mr-worldwide/500px/sagrada-familia-inside-2018-1.jpg
  66. BIN
      img/mr-worldwide/500px/sagrada-familia-inside-2018-2.jpg
  67. BIN
      img/mr-worldwide/500px/sagrada-familia-inside-2018-3.jpg
  68. BIN
      img/mr-worldwide/500px/sagrada-familia-outside-2018-0.jpg
  69. BIN
      img/mr-worldwide/500px/sagrada-familia-outside-2018-1.jpg
  70. BIN
      img/mr-worldwide/denver-2017.jpg
  71. BIN
      img/mr-worldwide/granada-2018-0.jpg
  72. BIN
      img/mr-worldwide/granada-2018-1.jpg
  73. BIN
      img/mr-worldwide/kyoto-2017.jpg
  74. BIN
      img/mr-worldwide/lisbon-2018.jpg
  75. BIN
      img/mr-worldwide/lisbon-escher-2018-0.jpg
  76. BIN
      img/mr-worldwide/lisbon-escher-2018-1.jpg
  77. BIN
      img/mr-worldwide/loadout-packed.jpg
  78. BIN
      img/mr-worldwide/loadout-unpacked.jpg
  79. BIN
      img/mr-worldwide/madrid-2018.jpg
  80. BIN
      img/mr-worldwide/munich-moosach-2018.jpg
  81. BIN
      img/mr-worldwide/munich-victory-gate-2018.jpg
  82. BIN
      img/mr-worldwide/notebook.jpg
  83. BIN
      img/mr-worldwide/sagrada-familia-inside-2018-0.jpg
  84. BIN
      img/mr-worldwide/sagrada-familia-inside-2018-1.jpg
  85. BIN
      img/mr-worldwide/sagrada-familia-inside-2018-2.jpg
  86. BIN
      img/mr-worldwide/sagrada-familia-inside-2018-3.jpg
  87. BIN
      img/mr-worldwide/sagrada-familia-outside-2018-0.jpg
  88. BIN
      img/mr-worldwide/sagrada-familia-outside-2018-1.jpg
  89. 39
      pic-resize.sh

@ -16,3 +16,11 @@ plugins:
- jekyll-paginate
date_format: "%b %-d, %Y"
img_widths:
- 500
- 1000
- 1500
- 2000
- 2500
- 3000

@ -114,7 +114,7 @@ down to the center of the city, and she showed me around the sights, like
Marienplatz and the Frauenkirche (one of many famous churches in Munich).
{% include image.html
src="mr-worldwide/munich-victory-gate-2018.jpg"
dir="mr-worldwide" file="munich-victory-gate-2018.jpg" width=4048
descr="Siegestor (Victory Gate), Munich, 2018"
%}
@ -127,7 +127,7 @@ all; like how even in a large city like Munich everything can still be closed on
a Sunday.
{% include image.html
src="mr-worldwide/munich-moosach-2018.jpg"
dir="mr-worldwide" file="munich-moosach-2018.jpg" width=3036
descr="Moosach neighborhood, Munich, 2018"
float="right"
%}
@ -405,12 +405,12 @@ constructed using private funds and donations since then.
<div style="text-align: center;">
{% include image.html
src="mr-worldwide/sagrada-familia-outside-2018-0.jpg"
dir="mr-worldwide" file="sagrada-familia-outside-2018-0.jpg" width=1080
inline=true
%}
{% include image.html
src="mr-worldwide/sagrada-familia-outside-2018-1.jpg"
dir="mr-worldwide" file="sagrada-familia-outside-2018-1.jpg" width=1080
inline=true
%}
<p><em>Outside faces of La Sagrada Familia, Barcelona, 2018</em></p>
@ -423,19 +423,19 @@ be like.
<div style="text-align: center;">
{% include image.html
src="mr-worldwide/sagrada-familia-inside-2018-0.jpg"
dir="mr-worldwide" file="sagrada-familia-inside-2018-0.jpg" width=1080
inline=true
%}
{% include image.html
src="mr-worldwide/sagrada-familia-inside-2018-1.jpg"
dir="mr-worldwide" file="sagrada-familia-inside-2018-1.jpg" width=1080
inline=true
%}
{% include image.html
src="mr-worldwide/sagrada-familia-inside-2018-2.jpg"
dir="mr-worldwide" file="sagrada-familia-inside-2018-2.jpg" width=1080
inline=true
%}
{% include image.html
src="mr-worldwide/sagrada-familia-inside-2018-3.jpg"
dir="mr-worldwide" file="sagrada-familia-inside-2018-3.jpg" width=1080
inline=true
%}
<p><em>The incredible interior of La Sagrada Familia, Barcelona, 2018</em></p>
@ -481,7 +481,7 @@ completely different. We saw some of the things a tourist is supposed to see,
like the opera house, the palace, and whatever this building is:
{% include image.html
src="mr-worldwide/madrid-2018.jpg"
dir="mr-worldwide" file="madrid-2018.jpg" width=3036
descr="This Schweppes building is called the Edificio Carrión, and is famous for reasons. Madrid, 2018"
%}
@ -569,7 +569,7 @@ the people had dug out caves in the side of the mountain, and made them into
homes. My hostel was in one of these caves.
{% include image.html
src="mr-worldwide/granada-2018-0.jpg"
dir="mr-worldwide" file="granada-2018-0.jpg" width=1329
descr="The view from my hostel, Alhambra on the left. Granada, 2018"
%}
@ -601,7 +601,7 @@ number of tickets per day to get inside the castle, so I missed a lot of it. So
I went back to the peace and quiet of Sacromonte.
{% include image.html
src="mr-worldwide/granada-2018-1.jpg"
dir="mr-worldwide" file="granada-2018-1.jpg" width=1329
descr="Sacromonte and the valley below. Granada, 2018"
%}
@ -637,7 +637,7 @@ in the country, and 9th most visited city in Southern Europe, it still feels
quiet and cozy.
{% include image.html
src="mr-worldwide/lisbon-2018.jpg"
dir="mr-worldwide" file="lisbon-2018.jpg" width=1772
descr="The facade of a museum I was too poor to go in. Lisbon, 2018"
%}
@ -669,11 +669,11 @@ spun his wheels on the same problems for most of his life.
<div style="text-align: center;">
{% include image.html
src="mr-worldwide/lisbon-escher-2018-0.jpg"
dir="mr-worldwide" file="lisbon-escher-2018-0.jpg" width=513
inline=true
%}
{% include image.html
src="mr-worldwide/lisbon-escher-2018-1.jpg"
dir="mr-worldwide" file="lisbon-escher-2018-1.jpg" width=341
inline=true
%}
<p><em>Tesselations, paradoxes, and tricks of perspective, Lisbon, 2018</em></p>

@ -14,8 +14,26 @@
display: inline-block;
{% endif -%}
">
<a href="/img/{{ include.src }}" target="_blank">
<img style="max-height: 60vh;"
src="/img/{{ include.src }}" alt="{{ include.descr }}" /></a>
<a href="/img/{{ include.dir }}/{{ include.file }}" target="_blank">
<picture>
{%- if include.width %}
{%- for targetWidth in site.img_widths reversed -%}
{% if include.width <= targetWidth %}{% continue %}{% endif %}
{%- if targetWidth > 1000 %}
<source media="(min-width: 1000px) and (min-resolution: {{ targetWidth | divided_by: 1000.0 }}dppx)"
{%- elsif targetWidth > 500 %}
<source media="(min-width: 500px), (min-resolution: 1.1dppx)"
{%- else %}
<source
{% endif %}
srcset="/img/{{ include.dir }}/{{ targetWidth }}px/{{ include.file }}"
>
{%- endfor %}
{%- endif %}
<img style="max-height: 60vh;"
src="/img/{{ include.dir }}/{{ include.file }}"
alt="{{ include.descr }}" />
</picture>
</a>
{%- if include.descr %}<br/><em>{{ include.descr }}</em>{%- endif %}
</div>

@ -13,7 +13,7 @@ for my entire life, up until that point, and it felt like a change was needed.
Denver was certainly a change, and ultimately I think it was one in the right
direction, but it turned out to not be enough.
{% include image.html src="mr-worldwide/denver-2017.jpg" %}
{% include image.html dir="mr-worldwide" file="denver-2017.jpg" width=1696 %}
While in Denver I'd rented a tiny studio apartment, which over the
course of two years I'd learned to live in. Living large is pretty easy; for
@ -51,7 +51,7 @@ because of how much time I was able to spend exploring (rather than being cooped
up working).
{% include image.html
src="mr-worldwide/kyoto-2017.jpg"
dir="mr-worldwide" file="kyoto-2017.jpg" width=5257
descr="Kyoto at sunset, 2017" %}
By the end of 2016 I knew I wanted to travel and see as much as possible, while
@ -78,7 +78,7 @@ gave me a small notebook to take notes in as I traveled, with some helpful
phrases that might aid me along the way
{% include image.html
src="mr-worldwide/notebook.jpg"
dir="mr-worldwide" file="notebook.jpg" width=3036
descr="Ibrahim made sure I was covered if I ever found myself in a tight spot"
%}
@ -104,13 +104,13 @@ some things with you. The big bag/day bag combo is a classic amongst ~~the
homeless~~ backpackers.
{% include image.html
src="mr-worldwide/loadout-packed.jpg"
dir="mr-worldwide" file="loadout-packed.jpg" width=4048
descr="All packed up, one for overhead and the other for under the seat"
inline=true
%}
{% include image.html
src="mr-worldwide/loadout-unpacked.jpg"
dir="mr-worldwide" file="loadout-unpacked.jpg" width=4048
descr="(Almost) everything, unpacked"
inline=true
%}

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 826 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1003 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 KiB

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 KiB

After

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 KiB

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 KiB

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 KiB

After

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 MiB

After

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 MiB

After

Width:  |  Height:  |  Size: 5.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 KiB

After

Width:  |  Height:  |  Size: 497 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 KiB

After

Width:  |  Height:  |  Size: 487 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 485 KiB

After

Width:  |  Height:  |  Size: 485 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 KiB

After

Width:  |  Height:  |  Size: 456 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 KiB

After

Width:  |  Height:  |  Size: 474 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 KiB

After

Width:  |  Height:  |  Size: 532 KiB

@ -0,0 +1,39 @@
#!/bin/sh
# requires imagemagick and perl-image-exiftool
set -e
widths="500 1000 1500 2000 2500 3000"
for img in $@; do
echo $img
# make target directories
dir=$(dirname "$img") # gets directory
for targetWidth in $widths; do
mkdir -p $dir/${targetWidth}px
done
# get width
width=$(identify "$img" | awk '{print $3}' | cut -dx -f1)
echo -e "\toriginal width: $width"
echo -e "\tremoving metadata"
exiftool -all= "$img"
rm -f "${img}_original" # exiftool makes a copy of the original, delete it
for targetWidth in $widths; do
targetFile=$dir/${targetWidth}px/$(basename "$img")
echo -en "\tresizing into $targetFile... "
if [ "$targetWidth" -ge "$width" ]; then
echo "skipping, original image too small"
continue
elif [ -e "$targetFile" ]; then
echo "skipping, target file exists"
continue
fi
convert "$img" -resize $targetWidth "$targetFile"
echo "done"
done
done
Loading…
Cancel
Save