huangyuzhang / gui

A Shell-based Ghost Static Generator
MIT License
22 stars 1 forks source link

Doesn't work with local images inserted in ghost blog #2

Open VimalMollyn opened 3 years ago

VimalMollyn commented 3 years ago

Hey! Thanks for creating a wonderful tool like this! I have one issue, that's the following: When I upload a custom banner image for a blog post, the image doesn't show up in the static site. Do you know if this can be fixed?

Thanks! Vimal

spanishhighs commented 2 years ago

The problem was caused by the converting of responsive images (srcset) by Wget. This from my .static/index.html file

<img class="post-card-image"
--
  | srcset="content/images/size/w300/2022/08/RA302229.jpg 300w,
  | content/images/size/w600/2022/08/RA302229.jpgg 600w,
  | content/images/size/w1000/2022/08/RA302229.jpgpg 1000w,
  | content/images/size/w2000/2022/08/RA302229.jpgjpg 2000w"
  | sizes="(max-width: 1000px) 400px, 800px"
  | src="content/images/size/w600/2022/08/RA302229.jpg"
  | alt="Comment"
  | loading="lazy"
  | />

Inserted the following lines into the bottom of gui.sh, using replace and seemed to cure it

LC_ALL=C find ./static -type f -not -wholename *.git* -exec sed -i '' -e "s,jpgg,jpg,g" {} +
LC_ALL=C find ./static -type f -not -wholename *.git* -exec sed -i '' -e "s,jpgpg,jpg,g" {} +
LC_ALL=C find ./static -type f -not -wholename *.git* -exec sed -i '' -e "s,jpegjpg,jpg,g" {} +