#include #include #include #include #include #include #include #include #include void convert(const String &strPathFileName,const String &strPathSaveFile,int width); //Console console(Console::ConsoleType(Console::Write|Console::Read),false); void writeLine(const String &string); Options getOptions(int argc,char **argv); void main(int argc,char **argv) { Block entryList; PathFind pathFind; String strExtension(".jpg"); String strMask("*"); String strPathDirectory; String strPathDestination; String strPathHTML("index.html"); File outFile; Profile profile; DiskInfo diskInfo; Options options; options=getOptions(argc,argv); if(1==argc||options.getHelp()) { writeLine("USAGE -s -d -iw -tw -q "); return; } writeLine("2001 diversified software solutions \"http://www.diversified-software.com\""); writeLine(String("source-path:")+options.getInputPath()); writeLine(String("destination-path:")+options.getOutputPath()); writeLine(String("thumbnail-width:")+String().fromInt(options.getThumbnailWidth())); writeLine(String("image-width:")+String().fromInt(options.getImageWidth())); writeLine(String("quality:")+String().fromInt(options.getQuality())); strPathDirectory=options.getInputPath()+String("\\"); strPathDestination=options.getOutputPath()+String("\\"); pathFind.fileList(strPathDirectory+strMask+strExtension,entryList); if(!entryList.size()) { writeLine("No entries found."); return; } if(!outFile.open(strPathDestination+strPathHTML,"wb")) { writeLine(String("Unable to create ")+String("'")+strPathDestination+strPathHTML+String("'.")); return; } outFile.writeLine(""); outFile.writeLine(""); outFile.writeLine("Image"); outFile.writeLine(""); outFile.writeLine(""); outFile.writeLine("

 

"); diskInfo.createDirectory(strPathDestination); for(int index=0;index")); } outFile.writeLine(""); outFile.writeLine(""); } void convert(const String &strPathFileName,const String &strPathSaveFile,int width) { JPGImage jpgImage; PureDevice screenDevice; Profile profile; String strSaveFileName; String strPathDirectory; DiskInfo diskInfo; strPathDirectory=strPathFileName; profile.makeFileName(strPathFileName,strSaveFileName); strSaveFileName=strSaveFileName.betweenString(0,'.'); strSaveFileName+=".bmp"; profile.makeDirectoryName(strPathDirectory); strPathDirectory+=String("\\")+strSaveFileName; screenDevice.screenDevice(); jpgImage.decode(strPathFileName,screenDevice); jpgImage.resample(screenDevice,width); jpgImage.saveBitmap(strPathDirectory); ImageConverter::convert(strPathDirectory,strPathSaveFile,100); diskInfo.unlink(strPathDirectory); } /* -s sourcedir -d destination -iw imagewidth -tw thumbnailwidth -q quality -? display help */ Options getOptions(int argc,char **argv) { Options options; for(int arg=1;arg