This commit is contained in:
2024-08-07 09:16:27 -04:00
parent fdfadd5c7e
commit 5f971cf684
5200 changed files with 731717 additions and 0 deletions

BIN
thumbnail/Debug/Main.obj Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
thumbnail/Debug/vc60.idb Normal file

Binary file not shown.

BIN
thumbnail/Debug/vc60.pdb Normal file

Binary file not shown.

168
thumbnail/Main.cpp Normal file
View File

@@ -0,0 +1,168 @@
#include <common/purehdc.hpp>
#include <common/pathfnd.hpp>
#include <common/profile.hpp>
#include <common/diskinfo.hpp>
#include <common/file.hpp>
#include <common/except.hpp>
#include <jpeg-6b/bmpjpg.hpp>
#include <jpgimg/jpgimg.hpp>
#include <thumbnail/options.hpp>
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<String> 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 <sourcedir> -d <destinationdir> -iw <imagewidth> -tw <thumbnailwidth> -q <quality>");
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("<HTML>");
outFile.writeLine("<HEAD>");
outFile.writeLine("<TITLE>Image</TITLE>");
outFile.writeLine("</HEAD>");
outFile.writeLine("<BODY>");
outFile.writeLine("<P>&nbsp;</P>");
diskInfo.createDirectory(strPathDestination);
for(int index=0;index<entryList.size();index++)
{
String strPathFileName=strPathDirectory+entryList[index];
String strPathImageSmall=entryList[index];
String strPathImageLarge=entryList[index];
profile.makeFileName(strPathImageSmall);
profile.makeFileName(strPathImageLarge);
profile.removeExtension(strPathImageSmall);
profile.removeExtension(strPathImageLarge);
strPathImageSmall+=String("_s")+strExtension;
strPathImageLarge+=String("_l")+strExtension;
writeLine(String("converting ")+strPathFileName+String(" ")+String().fromInt(index+1)+String(" of ")+String().fromInt(entryList.size()));
convert(strPathDirectory+entryList[index],strPathDestination+strPathImageLarge,options.getImageWidth());
convert(strPathDirectory+entryList[index],strPathDestination+strPathImageSmall,options.getThumbnailWidth());
outFile.writeLine(String("<A HREF=\"")+strPathImageLarge+String("\"><IMG BORDER=\"2\" SRC=\"")+strPathImageSmall+String("\">"));
}
outFile.writeLine("</BODY>");
outFile.writeLine("</HTML>");
}
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<argc;arg+=2)
{
String argument(argv[arg]);
argument.lower();
if(argument=="-s")
{
try{options.setInputPath(argv[arg+1]);}
catch(...){}
}
else if(argument=="-d")
{
try{options.setOutputPath(argv[arg+1]);}
catch(...){}
}
else if(argument=="-iw")
{
try{options.setImageWidth(String(argv[arg+1]).toInt());}
catch(...){options.setImageWidth(640);}
}
else if(argument=="-tw")
{
try{options.setThumbnailWidth(String(argv[arg+1]).toInt());}
catch(...){options.setThumbnailWidth(220);}
}
else if(argument=="-q")
{
try{options.setQuality(String(argv[arg+1]).toInt());}
catch(...){options.setQuality(100);}
}
else if(argument=="-?")
{
options.setHelp(true);
}
else writeLine(String("invalid argument '")+String(argv[arg])+String("'"));
}
if(options.getInputPath().isNull())options.setInputPath(".");
if(options.getOutputPath().isNull())options.setOutputPath(".");
return options;
}
void writeLine(const String &string)
{
::printf("%s\n",string.str());
}

134
thumbnail/options.hpp Normal file
View File

@@ -0,0 +1,134 @@
#ifndef _THUMBNAIL_OPTIONS_HPP_
#define _THUMBNAIL_OPTIONS_HPP_
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
class Options
{
public:
Options(void);
Options(const Options &options);
virtual ~Options();
int getQuality(void)const;
void setQuality(int quality);
const String &getInputPath(void)const;
void setInputPath(const String &strInputPath);
const String &getOutputPath(void)const;
void setOutputPath(const String &strOuputPath);
int getImageWidth(void)const;
void setImageWidth(int imageWidth);
int getThumbnailWidth(void)const;
void setThumbnailWidth(int thumbnailWidth);
bool getHelp(void)const;
void setHelp(bool help);
Options &operator=(const Options &options);
private:
int mQuality;
int mThumbnailWidth;
int mImageWidth;
String mInputPath;
String mOutputPath;
bool mHelp;
};
inline
Options::Options(void)
: mQuality(100), mThumbnailWidth(220), mImageWidth(640), mHelp(false)
{
}
inline
Options::Options(const Options &options)
{
*this=options;
}
inline
Options::~Options()
{
}
inline
Options &Options::operator=(const Options &options)
{
setQuality(options.getQuality());
setInputPath(options.getInputPath());
setOutputPath(options.getOutputPath());
setImageWidth(options.getImageWidth());
setThumbnailWidth(options.getThumbnailWidth());
return *this;
}
inline
int Options::getQuality(void)const
{
return mQuality;
}
inline
void Options::setQuality(int quality)
{
mQuality=quality;
}
inline
const String &Options::getInputPath(void)const
{
return mInputPath;
}
inline
void Options::setInputPath(const String &strInputPath)
{
mInputPath=strInputPath;
}
inline
const String &Options::getOutputPath(void)const
{
return mOutputPath;
}
inline
void Options::setOutputPath(const String &strOutputPath)
{
mOutputPath=strOutputPath;
}
inline
int Options::getImageWidth(void)const
{
return mImageWidth;
}
inline
void Options::setImageWidth(int imageWidth)
{
mImageWidth=imageWidth;
}
inline
int Options::getThumbnailWidth(void)const
{
return mThumbnailWidth;
}
inline
void Options::setThumbnailWidth(int thumbnailWidth)
{
mThumbnailWidth=thumbnailWidth;
}
inline
bool Options::getHelp(void)const
{
return mHelp;
}
inline
void Options::setHelp(bool help)
{
mHelp=help;
}
#endif

101
thumbnail/thumbnail.dsp Normal file
View File

@@ -0,0 +1,101 @@
# Microsoft Developer Studio Project File - Name="thumbnail" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=thumbnail - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "thumbnail.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "thumbnail.mak" CFG="thumbnail - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "thumbnail - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "thumbnail - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "thumbnail - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "thumbnail - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /Gz /MT /GX /Zi /O2 /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "STRICT" /D "__FLAT__" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "thumbnail - Win32 Release"
# Name "thumbnail - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\Main.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

89
thumbnail/thumbnail.dsw Normal file
View File

@@ -0,0 +1,89 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "bsptree"=..\bsptree\bsptree.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "common"=..\common\common.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "jpeg6b"="..\..\parts\jpeg-6b\jpeg6b.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "jpgimg"=..\jpgimg\jpgimg.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "thumbnail"=.\thumbnail.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name bsptree
End Project Dependency
Begin Project Dependency
Project_Dep_Name common
End Project Dependency
Begin Project Dependency
Project_Dep_Name jpeg6b
End Project Dependency
Begin Project Dependency
Project_Dep_Name jpgimg
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

BIN
thumbnail/thumbnail.ncb Normal file

Binary file not shown.

BIN
thumbnail/thumbnail.opt Normal file

Binary file not shown.

30
thumbnail/thumbnail.plg Normal file
View File

@@ -0,0 +1,30 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: thumbnail - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\sean\LOCALS~1\Temp\RSP1543.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/thumbnail.pdb" /debug /machine:I386 /out:"Debug/thumbnail.exe" /pdbtype:sept
.\Debug\Main.obj
\work\exe\msbsp.lib
\work\exe\mscommon.lib
"\parts\jpeg-6b\lib\jpeg6b.lib"
\work\exe\jpgimg.lib
]
Creating command line "link.exe @C:\DOCUME~1\sean\LOCALS~1\Temp\RSP1543.tmp"
<h3>Output Window</h3>
Linking...
Creating library Debug/thumbnail.lib and object Debug/thumbnail.exp
LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library
<h3>Results</h3>
thumbnail.exe - 0 error(s), 1 warning(s)
</pre>
</body>
</html>