Last active
August 17, 2018 23:04
-
-
Save QuadStorm/7ac13a0c50a79990c0947e7a1dbcd54c to your computer and use it in GitHub Desktop.
Make gallery posts using a list of imgur links using TorqueScript; assumes PNG images and will have the images tiled by two at 1080p.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prepImgurLink(%link) | |
{ | |
%link = strReplace(%link, "https://im", "https://i.im"); | |
if (strStr(%link, ".png") == -1 || strStr(%link, ".jpg") == -1) | |
{ | |
%link = %link @ ".png"; | |
} | |
return %link; | |
} | |
$idoublespace = 1; | |
function convertImgurLinks(%links) | |
{ | |
for (%i = 0; %i < getWordCount(%links); %i++) | |
{ | |
%curLink = getWord(%links, %i); | |
%curLink = stripMLControlChars(prepImgurLink(%curLink)); | |
%output = %output @ "[img width=900]" @ %curLink @ "[/img]" SPC ($idoublespace ? " " : ""); | |
} | |
return %output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment