Tumblr Image Size

When directly viewing an image on Tumblr, ensures that the highest resolution image is loaded.

< Feedback on Tumblr Image Size

Review: Good - script works

§
Posted: 2017-07-17
Edited: 2017-07-17

Patch to improve to actual best quality here

I'm surprised you only go for the 1280p version of the files, which is NOT the "highest" resolution available.

Example: small: https://68.media.tumblr.com/##########/tumblrorronwuFzC1umluozo5**540.png better: https://68.media.tumblr.com/##########/tumblr_orronwuFzC1umluozo51280.png best if available: https://68**.media.tumblr.com/##########/tumblrorronwuFzC1umluozo5_raw.png best also and more likely: https://media.tumblr.com/##########/tumblrorronwuFzC1umluozo5**raw**.png

Simply change the regexp as follows and it works: var sizes = [ '_raw.', '_1280.', '_540.', '_500.', '_400.', '_250.', '_100.' ]; ... var url = window.location.href.replace(/(https?:\/\/)\d+\.(.*(?=_))(_\d*.)(.*)/, '$1' + '$2' + sizes[index] + '$4');

Please update accordingly?

§
Posted: 2017-07-17

Actually, still need a fallback, if the raw does not exist or is inaccessible (shouldn't happen really, but just in case...)

var sizes = [ '_raw.', '_1280.', '_540.', '_500.', '_400.', '_250.', '_100.' ];

function checkSize(index) {
    if (index >= sizes.length) return;
    var url = "";
    if (index <= 1) {
        url = window.location.href.replace(/(https?:\/\/)\d+\.(.*(?=_))(_\d*.)(.*)/, '$1' + '$2' + sizes[index] + '$4');
    }
    else if (index > 1) {
        url = window.location.href.replace(/\d+\.(.*(?=_))(_\d*.)(.*)/, '$1' + sizes[index] + '$3');
    }
    if (url == window.location.href) return;

etc...

DimethylAuthor
§
Posted: 2017-09-30

I didn't even know a 'raw' version was available, thanks for the info. I've updated the script to prefer the 'raw' version.

Post reply

Sign in to post a reply.