Adobe Photoshop 5.0 and newer versions as well as various other batch-processing 
programs can create all the thumbnails for you.

Once you've got the images processed, you can use code such as the templates below to 
display the images.  For a working example of this code, take a look at my personal 
site - photo section, high-bandwidth area.


<!-- begin display_photo_list.cfm -->

<cfinclude template="header.cfm">


<!--- <script language="JavaScript1.1">
<!-- Begin
function right(e){
if (navigator.appName=='Netscape'&&
(e.which==3||e.which == 2))
return false;
else if(navigator.appName=='Microsoft Internet Explorer'&&
(event.button==2||event.button==3)){
alert("Please don't steal my images.  Thanks.");
return false;
}
return true; 
}
document.onmousedown=right; 
if(document.layers)window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
//End-->
</script> --->

<cfset center_color = "F4B642">
<cfset center_align = "center">
<cfset center_valign = "middle">

<center>

<table width="100%" cellpadding="5" cellspacing="0" border="0">
<CFDIRECTORY DIRECTORY="#GetDirectoryFromPath(GetTemplatePath())#/photography/small"   
 NAME="myDirectory">

<cfoutput query="myDirectory">

<cfif (size neq 0) and (name does not contain ".cfm") and (name does not contain 
".txt")>

<cfset enlarged_file_name = "#ReplaceNoCase("#name#","_sm","", "ALL")#">
<cfset caption_file_name = 
"#ReplaceNoCase("#enlarged_file_name#",".jpg",".txt","ALL")#">

<tr>
<td valign="middle"><font face="#fontface#" size="#fontsize#"><a 
href="display_photo.cfm?photo=#enlarged_file_name#" target="_window"><img 
src="photography/small/#name#"></a></font></td>
<td valign="middle"><font face="#fontface#" size="#fontsize#">


<!--- TEST #session.rootpath#/photography/captions/#caption_file_name# --->
<!--- note: comment this out and uncomment the text file initialization code below to 
create files automatically for all the thumbnails --->

<cfinclude template="photography/captions/#caption_file_name#">

</font></td>
</tr>

<!---initialize text files--->

<!---  <cffile action="WRITE" 
file="#GetDirectoryFromPath(GetTemplatePath())#/photography/captions/#caption_file_name#"
 output="#caption_file_name# text" addnewline="Yes"> --->


</cfif>

</cfoutput>
</table>
</center>

<cfinclude template="footer.cfm">

<!-- end display_photo_list.cfm -->

<cfinclude template="header.cfm">

<script language="JavaScript1.1">
<!-- Begin
function right(e){
if (navigator.appName=='Netscape'&&
(e.which==3||e.which == 2))
return false;
else if(navigator.appName=='Microsoft Internet Explorer'&&
(event.button==2||event.button==3)){
alert("Please don't steal my images.  Thanks.");
return false;
}
return true; 
}
document.onmousedown=right; 
if(document.layers)window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
//End-->
</script>

<form action="" method="post" onSubmit="self.close()">
<input type="submit" value="Close">
</form>

<CFIF FileExists("#template_path_enlarged_photos_directory#/#photo#")>
        <cfoutput>
        <img src="#web_path_enlarged_photos_directory#/#photo#">
        </cfoutput>
<CFELSE>
Sorry!  An error occured.  This file does not exist.
</cfif>


<form action="" method="post" onSubmit="self.close()">
<input type="submit" value="Close">
</form>

<cfinclude template="header.cfm">

---mark

========================================Mark Warrick - Fusioneers.com
Personal Email: [EMAIL PROTECTED]
Business Email: [EMAIL PROTECTED]
Phone: 714-547-5386
Efax: 801-730-7289
Personal URL: http://www.warrick.net
Business URL: http://www.fusioneers.com
ICQ: 125160 / AIM: markwarric
========================================

-----Original Message-----
From: admin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 25, 2001 9:39 AM
To: CF-Talk
Subject: Thumbnails


Can anyone recommend the most efficient way to create thumbnail images from a 
directory dynamically.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to