diff --git a/project.el b/project.el index 6bc861f..a1eb9cc 100644 --- a/project.el +++ b/project.el @@ -259,6 +259,31 @@ (kill-buffer)) file-path)) +(defun compress-image (filename dst-file) + "Compress images using imagemagick" + (shell-command + (format + (concat + "~/.nix-profile/bin/convert" + " %s" ;; source + " -sampling-factor 4:2:0" + " -strip" + " -resize 400x400\\>" + " -interlace Place" + " -gaussian-blur 0.05" + " -quality 85" + " -colorspace Gray" + " -ordered-dither o8x8,8" + "%s" ;; dest + ) + filename + dst-file))) + +(defun compress-css (root-dir filename dst-file) + "Compress CSS usin compresscss.sh script" + (shell-command + (format "%s/engine/compresscss.sh %s %s" root-dir filename dst-file))) + (defun org-blog-publish-attachment (plist filename pub-dir) "Publish a file with no transformation of any kind. FILENAME is the filename of the Org file to be published. PLIST @@ -272,11 +297,9 @@ Return output file name." (file-name-as-directory (expand-file-name pub-dir))) (let ((dst-file (expand-file-name (file-name-nondirectory filename) pub-dir))) (cond ((string-match-p ".*\\.\\(png\\|jpg\\|gif\\)$" filename) - (shell-command (format "~/.nix-profile/bin/convert %s -resize 400x400\\> -colorspace Gray -ordered-dither o8x8,8 %s" - filename - dst-file))) + (compress-image filename dst-file)) ((string-match-p ".*\\.css$" filename) - (shell-command (format "%s/engine/compresscss.sh %s %s" root-dir filename dst-file))) + (compress-css root-dir filename dst-file)) (t (copy-file filename dst-file t)))))) (defalias 'org-blog-posts-sitemap-fn diff --git a/project.el.sig b/project.el.sig index 5fd442f..6cd76e6 100644 Binary files a/project.el.sig and b/project.el.sig differ diff --git a/src/posts/0001-new-blog/index.org b/src/posts/0001-new-blog/index.org index 403a2a7..23a4f62 100644 --- a/src/posts/0001-new-blog/index.org +++ b/src/posts/0001-new-blog/index.org @@ -2,7 +2,7 @@ #+SUBTITLE: Meta Post (not really related to Donald Knuth) #+AUTHOR: Yann Esposito #+EMAIL: yann@esposito.host -#+DATE: [2019-08-17 Sat] +#+DATE: [2019-08-17 Sat 16:00] #+KEYWORDS: programming, blog, org-mode, web, css #+DESCRIPTION: Meta article about how I generate this blog. #+OPTIONS: auto-id:t diff --git a/src/posts/0002-troll-2/index.org b/src/posts/0002-troll-2/index.org index 1c9a09e..2671b78 100644 --- a/src/posts/0002-troll-2/index.org +++ b/src/posts/0002-troll-2/index.org @@ -2,7 +2,7 @@ #+Subtitle: How a terrible movie can be entertaining #+Author: Yann Esposito #+Email: yann@esposito.host -#+Date: [2019-08-17 Sat] +#+Date: [2019-08-17 Sat 20:00] #+KEYWORDS: movie #+DESCRIPTION: I watched what may be the worse movie of all time and I still enjoyed greatly the show. #+LANGUAGE: en