Portfolio site for Dallas – Fort Worth based photographer Kristopher Michael Ellis. KristopherMichaelEllis.com
Latest Posts
Automating “Save for Web” File Naming
It’s easy enough to make a macro to output multiple sizes of jpgs into different folders, but if you want multiple sizes of the image in the same folder, what can you do? This.
//vars
var doc = app.activeDocument;
// get a reference to the active document and store it in a variable named "doc"
var fname = new String (doc.name);
//get filename of doc
fname = fname.substr (0, fname.lastIndexOf("."));
//remove extension
var folder = doc.path;
//get folder of doc
var folderStr = folder.toString() + "/jpg";
//name the subfolder to be created in current folder
var outfolder = new Folder (folderStr);
//make Folder object
if (!outfolder.exists) { //check if subfolder already exists
outfolder.create();
//create the subfolder if it doesn't exist
}
//functions
function resize(height) {
doc.resizeImage(null,UnitValue(height,"px"),null,ResampleMethod.BICUBICSHARPER);
//resize image to specified height, keeping aspect ratio
}
function saveForWeb(outputFolderStr, filename) {
var opts, file;
opts = new ExportOptionsSaveForWeb();
//create object for save for web options
opts.format = SaveDocumentType.JPEG;
//specify format option jpg
if (filename.length > 27) { //check filename length so it won't get trunctuated
file = new File(outputFolderStr + "/temp.jpg");
//temp file name because file name would be too long
activeDocument.exportDocument(file, ExportType.SAVEFORWEB, opts);
//export
file.rename(filename + ".jpg");
//rename temp file to the desired name
} else { //desired name is short enough
file = new File(outputFolderStr + "/" + filename + ".jpg");
activeDocument.exportDocument(file, ExportType.SAVEFORWEB, opts);
//export
}
}
//run
resize(1200);
saveForWeb(folderStr, fname + "-zoom");
resize(600);
saveForWeb(folderStr, fname + "-large");
resize(250);
saveForWeb(folderStr, fname);
If you wanted to use a predetermined folder instead of creating a subfolder, you could just change this:
var currentFolder = doc.path; //get folder of doc var folderStr = currentFolder.toString() + "/jpg"; //name the subfolder to be created in current folder
to this:
var folderStr = "/your/path/here" //use your desired folder for output
Square Canvas in Photoshop with Javascript
This script is really simple, but it can be really useful if you need to make a lot of images square instead of rectangle. You can run it from File > Scripts > Browse…, but since we are talking about using it for a lot of images, you would probably want to record a macro. Then you can use the macro as any regular Photoshop macro.
var w = app.activeDocument.width;
var h = app.activeDocument.height;
if (w > h) {
app.activeDocument.resizeCanvas(w,w);
}
if (h > w) {
app.activeDocument.resizeCanvas(h,h);
}
Sharing is Caring WordPress Plugin
This is a WordPress plugin that displays the official social sharing buttons from Facebook, Twitter, Google+ and Pinterest with your posts. It also adds some meta tags for opengraph and schema.org as recommended by Facebook and Google. The standard method to do this is by filtering the content of the posts, which is controlled by the options in the admin menu. Buttons can also be displayed by the shortcode [sic] with ability to disable individual buttons for that instance of the shortcode. You can also add it to your theme with do_action(‘sic_sharing’); where you want it to render.
Allows some custom text and css insertion as well as most options for the buttons in the admin page. Compatible with html5 (optional).
Current Version: 1.4.3
It is in use on this page.
Your questions and comments are welcome.
Download the Sharing is Caring plugin
Shortcode Use
[sic] will display the buttons as set in the option menu
You can also add the optional parameters f=0, t=0, g=0, and p=0 to disable specific buttons for that instance of the shortcode.
[sic f=0] will display the buttons as set in the option menu, except Facebook
[sic t=0 g=0 p=0] will display only the Facebook button



