well after many months of on and off at this script it works, minus the fact it doesn’t have the save options-- but I decided to share anyway since some people might need this::
it scales the images and then adds a padding around it by resizing the canvas
you can modify it so you can scale a set size of images and have a final output for large web production
//Copyright Wesley Paisley
//2008 Modified by Wesley Paisley
//Made to order by Wesley Paisley
//Special guest: Wesley Paisley
// A Script to Resize an image in proportion to its long or short side.
// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop
// in case we double clicked the file
app.bringToFront();
// Save the current preferences
//declare variables
var startDisplayDialogs = app.displayDialogs;
var startRulerUnits = app.preferences.rulerUnits;
var startTypeUnits = app.preferences.typeUnits;
var startDisplayDialogs = app.displayDialogs;
// Set Adobe Photoshop CS3 to use pixels and display no dialogs
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
//sets background color to white
app.displayDialogs = DialogModes.NO;
app.backgroundColor.rgb.red = 255;
app.backgroundColor.rgb.blue = 255;
app.backgroundColor.rgb.green = 255;
//sets foreground color to white
app.foregroundColor.rgb.red = 255;
app.foregroundColor.rgb.blue = 255;
app.foregroundColor.rgb.green = 255;
// ask the user for the input folder
var inputFolder = Folder.selectDialog("Select a folder to re-size_images");
// ask the user for the output folder
var outputFolder = Folder.selectDialog("Select a folder for the output files");
// see if we get something interesting from the dialog
//if (inputFolder != null && outputFolder != null) {
// get all the jpg files found in this folder
var fileList = new Array();
fileList = inputFolder.getFiles("*.jpg");//uses wildcard
// open each file
for (var i = 0; i < fileList.length; i++) {
// The fileList is folders and files so open only files
if (fileList* instanceof File) {
open(fileList*)
}
// save the outputs in JPEG
var jpegOptions = new JPEGSaveOptions();
// set the jpeg quality really low so the files are small
jpegOptions.quality = 7;
var DL = app.documents.length; // current documents open
for(a=1;a<=DL;a++){
// Initialise the user defined variables
var dpi = 72;//dpi of document
// Initialise the fixed variables
var doc = app.activeDocument;
var width = doc.width.value;//document width
var height = doc.height.value;//document height
if(dpi != 72){
doc.resizeImage(width,height,72);
detectHW();
}else{
detectHW();
}
function detectHW(){//detecting which is a larger value height or width
if(height>width){
scaleY();
}else {
scaleX();
}
}
function scaleX(){
newW1 = (width*158)/height;
doc.resizeImage(newW1,158,72,
ResampleMethod.BICUBICSMOOTHER);
if(newW1>144){//then do another round of image scaling
newH2=(height*144)/width;
doc.resizeImage(144,newH2,72,
ResampleMethod.BICUBICSMOOTHER);
doc.resizeCanvas(144,158);//resize canvase size which will create padding on the sides
}else{
doc.resizeCanvas(144,158);//resize canvase size which will create padding on the sides
}
}
function scaleY(){
newH1 = (height*144)/width;
doc.resizeImage(144,newH1,72,
ResampleMethod.BICUBICSMOOTHER);
if(newH1>158 ){//then do another round of image scaling
newW2 =(width*158)/height;
doc.resizeImage(newW2,158,72,
ResampleMethod.BICUBICSMOOTHER);
doc.resizeCanvas(144,158);//resize canvase size which will create padding on the sides
}else{
doc.resizeCanvas(144,158);//resize canvase size which will create padding on the sides
}
}
// clean-up
/*app.preferences.rulerUnits = orig_ruler_units;
var doc = null*/
/*while (app.documents.length >=1){//while for batch processing
// save and close
var i = "_lg";
//var outputFolder = "../test";
//doc.saveAs(new File(outputFolder + i + ".jpg")LOWERCASE);
//doc.close(SaveOptions.SAVECHANGES);
fileClose(SaveOptions.SAVECHANGES);
}
//doc.close(SaveOptions.SAVECHANGES);*/
//app.activeDocument.close(SaveOptions.SAVECHANGES);//closes active documents
}
}//end of open(fileList)
right now it works in Photoshop CS3 on a pC, it should work on a mac since it uses javascript