Skip to content

Instantly share code, notes, and snippets.

@murtaugh
Last active June 1, 2016 23:02
Show Gist options
  • Save murtaugh/cb0700106b191a4e3027 to your computer and use it in GitHub Desktop.
Save murtaugh/cb0700106b191a4e3027 to your computer and use it in GitHub Desktop.
Convince ExpressionEngine to show SVG thumbnails
# redirect requests to (non-existent) SVG thumbnails to the main image
RewriteRule ^/assets_content/_thumbs/?\.svg$ /assets_content/$1.svg [NC,L]
# FWIW, I had to swap out the ? for (.*) in my environment
/* make sure the svg thumbnail doesn't blow out the page; give it a checkerboard background */
.publish_field .filename img[src$=".svg"] {
width: 100px;
max-width: 100%;
padding: 12px;
background-color: rgba(0,0,0,.05);
background-image: linear-gradient(45deg, rgba(0,0,0,.05) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.05) 75%, rgba(0,0,0,.05)),
linear-gradient(45deg, rgba(0,0,0,.05) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.05) 75%, rgba(0,0,0,.05));
background-size: 40px 40px;
background-position: 0 0, 20px 20px;
}
@blainsmith
Copy link

Nice! Glad you got it working!

@murtaugh
Copy link
Author

murtaugh commented May 19, 2016

FYI, for Dreamhost I had to remove the leading /:

RewriteRule ^assets_content/_thumbs/?\.svg$ /assets_content/$1.svg [NC,L]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment