Skip to content

Instantly share code, notes, and snippets.

@leobossmann
Created December 6, 2016 15:54
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save leobossmann/4991ad9355c755edd4b5eb57e9bb4f4c to your computer and use it in GitHub Desktop.
Save leobossmann/4991ad9355c755edd4b5eb57e9bb4f4c to your computer and use it in GitHub Desktop.
Extract and rename images from Pixieset
var imgs = new Array;
// replace all images by the xxl version
$('li > img').each(function(i, item){
var new_src = $(item).prop('src').replace('large', 'xxlarge');
$(item).prop('src', new_src);
imgs.push($(item));
});
// kill everything on page
$('body').empty();
// add all images
$(imgs).each(function(i,item){
$('body').append($(item));
});
// add a textarea containing a shell script to rename the files to their original name
var pattern = /.*\/([0-9a-f]{32}-xxlarge.jpg)/
var rename_script = "#!/bin/bash\n\n";
$(imgs).each(function(i,item){
var old_name = pattern.exec($(item).prop('src'))[1];
var new_name = $(item).prop('alt');
var line = 'mv ' + old_name + ' ' + new_name + "\n";
rename_script = rename_script + line;
});
$('body').append($('<textarea>').val(rename_script));
// Save the resulting page, and use the script in the textarea to rename the image files.
@mariamway
Copy link

Could you make one for Shootproof, please? :)

@leobossmann
Copy link
Author

Sorry, this was a one-off thing, I really can't provide support. But any JS developer (who will probably cringe at this) will be able to help you. I can't say if it'll work with Shootproof…

@creaturex
Copy link

Thanks for this few lines :) saved me a lot of time! cheers.

@leobossmann
Copy link
Author

You're welcome, glad that it still works 🙂

@Teodor-Tenev
Copy link

Thanks a lot

@leobossmann
Copy link
Author

@Teodor-Tenev you're welcome 🙂

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