Search code examples
htmlcsstumblrretina-display

Tumblr -hd images?


I'm working on a Tumblr theme.

I want my theme to be @2x compatible so I the jQuery retina plugin:
https://github.com/tylercraft/jQuery-Retina

You must name your files the same, except that you add a suffix of your choice to the @2x one, line -hd or _2x.

You can make your images available via Static Tumblr Upload.

The problem is, that Tumblr always generates a custom URL component:
http://static.tumblr.com/user/aRandomCode/blabla.png

Now that random code is what is messing it up.

How should I fix this? I'm assuming that I'm probably not the only one making them in @2x.


Solution

  • Instead of using a jQuery plugin, you can just specify your new assets with CSS:

    @media 
    only screen and (-webkit-min-device-pixel-ratio: 2), 
    only screen and (min-resolution: 192dpi) { 
        /* Retina-specific stuff here */
    }
    

    This will cut down on needing to load an extra plugin. More reading: http://www.brettjankord.com/2012/11/28/cross-browser-retinahigh-resolution-media-queries/