Skip to content

Commit

Permalink
Deploying to gh-pages from @ b51f02d 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
jmattheis committed Nov 7, 2024
1 parent 464da4f commit 585ed0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/optimize-images.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ <h2><a class="anchor" aria-hidden="true" id="prerequisites"></a><a href="#prereq
</ul>
<h2><a class="anchor" aria-hidden="true" id="script"></a><a href="#script" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Script</h2>
<p>Create a script, e.g. <code>/opt/gotify/optimize-images.sh</code> containing</p>
<pre><code class="hljs css language-bash"><span class="hljs-meta">#!/usr/bin/env sh</span>
<pre><code class="hljs css language-bash"><span class="hljs-meta">#!/usr/bin/env bash</span>
<span class="hljs-built_in">set</span> -e

DATA=/home/jm/src/gotify/server/data

<span class="hljs-keyword">for</span> FILE <span class="hljs-keyword">in</span> <span class="hljs-string">"<span class="hljs-variable">$DATA</span>"</span>/images/*; <span class="hljs-keyword">do</span>
<span class="hljs-keyword">if</span> [ <span class="hljs-string">"<span class="hljs-variable">$FILE</span>"</span> -nt <span class="hljs-string">"<span class="hljs-variable">$DATA</span>"</span>/images-optimized ]; <span class="hljs-keyword">then</span>
EXT=$(<span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">${FILE#*.}</span>"</span>|tr <span class="hljs-string">'[:upper:]'</span> <span class="hljs-string">'[:lower:]'</span>)
EXT=$(<span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">${FILE##*.}</span>"</span>|tr <span class="hljs-string">'[:upper:]'</span> <span class="hljs-string">'[:lower:]'</span>)
<span class="hljs-keyword">if</span> [ <span class="hljs-string">"<span class="hljs-variable">$EXT</span>"</span> = png -o <span class="hljs-string">"<span class="hljs-variable">$EXT</span>"</span> = jpg -o <span class="hljs-string">"<span class="hljs-variable">$EXT</span>"</span> = jpeg -o <span class="hljs-string">"<span class="hljs-variable">$EXT</span>"</span> = gif ]; <span class="hljs-keyword">then</span>
convert <span class="hljs-string">"<span class="hljs-variable">$FILE</span>"</span> -resize <span class="hljs-string">"512&gt;"</span> <span class="hljs-string">"<span class="hljs-variable">$FILE</span>"</span>
<span class="hljs-keyword">fi</span>
Expand Down
4 changes: 2 additions & 2 deletions docs/optimize-images/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ <h2><a class="anchor" aria-hidden="true" id="prerequisites"></a><a href="#prereq
</ul>
<h2><a class="anchor" aria-hidden="true" id="script"></a><a href="#script" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Script</h2>
<p>Create a script, e.g. <code>/opt/gotify/optimize-images.sh</code> containing</p>
<pre><code class="hljs css language-bash"><span class="hljs-meta">#!/usr/bin/env sh</span>
<pre><code class="hljs css language-bash"><span class="hljs-meta">#!/usr/bin/env bash</span>
<span class="hljs-built_in">set</span> -e

DATA=/home/jm/src/gotify/server/data

<span class="hljs-keyword">for</span> FILE <span class="hljs-keyword">in</span> <span class="hljs-string">"<span class="hljs-variable">$DATA</span>"</span>/images/*; <span class="hljs-keyword">do</span>
<span class="hljs-keyword">if</span> [ <span class="hljs-string">"<span class="hljs-variable">$FILE</span>"</span> -nt <span class="hljs-string">"<span class="hljs-variable">$DATA</span>"</span>/images-optimized ]; <span class="hljs-keyword">then</span>
EXT=$(<span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">${FILE#*.}</span>"</span>|tr <span class="hljs-string">'[:upper:]'</span> <span class="hljs-string">'[:lower:]'</span>)
EXT=$(<span class="hljs-built_in">echo</span> <span class="hljs-string">"<span class="hljs-variable">${FILE##*.}</span>"</span>|tr <span class="hljs-string">'[:upper:]'</span> <span class="hljs-string">'[:lower:]'</span>)
<span class="hljs-keyword">if</span> [ <span class="hljs-string">"<span class="hljs-variable">$EXT</span>"</span> = png -o <span class="hljs-string">"<span class="hljs-variable">$EXT</span>"</span> = jpg -o <span class="hljs-string">"<span class="hljs-variable">$EXT</span>"</span> = jpeg -o <span class="hljs-string">"<span class="hljs-variable">$EXT</span>"</span> = gif ]; <span class="hljs-keyword">then</span>
convert <span class="hljs-string">"<span class="hljs-variable">$FILE</span>"</span> -resize <span class="hljs-string">"512&gt;"</span> <span class="hljs-string">"<span class="hljs-variable">$FILE</span>"</span>
<span class="hljs-keyword">fi</span>
Expand Down

0 comments on commit 585ed0a

Please sign in to comment.