Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Bill #1
Part 1 - Massimo's tmt_img.cfc "Anyone"
If anyone here can help me out with this I would be forever grateful
I need to change the image directory path in this CFC. Currently it works
great as long as the images reside in the same folder. However, the images I
need to work with are not in this folder.
The way it is now I have these two files(form & CFC) in the admin folder.
/shop/admin/. the image are in /shop/assets/folder1, /shop/assets/folder2/
etc.
I am using this on a admin file form.and trying to use it to automatically
generate a thumbnail image from one larger image.
The form with this CFC is as follows
**********************************************
THE FORM
<cfprocessingdirective pageencoding="iso-8859-1">
<cfparam name="form.imagepath" default="minitrain.jpg" type="string">
<cfif StructKeyExists(form, "submit")>
<cfscript>
imgObj=CreateObject("component", "tmt_img");
imgObj.resize(form.imagepath, "thumb_#form.imagepath#", 250);
imgObj.crop(form.imagepath, "crop_#form.imagepath#");
</cfscript>
</cfif>
<!---
/**
* Turn any system path, either local or absolute, into a fully qualified one
* @output suppressed
* @param path (string) Required. Abstract pathname
* @return string
*/
--->
<cffunction name="getAbsolutePath" output="false" returntype="string"
hint="Turn any system path, either local or absolute, into a fully qualified
one">
<cfargument name="path" type="string" required="true" hint="Abstract
pathname">
<cfscript>
var jFile = createObject("java","java.io.File").init(arguments .path);
if(jFile.isAbsolute()){
return arguments.path;
}
else{
return ExpandPath(arguments.path);
}
</cfscript>
</cffunction>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>tmt_img sample</title>
<link href="style_distro.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form name="form1" method="post"
action="<cfoutput>#GetFileFromPath(GetTemplatePath ())#</cfoutput>">
<p> Just a very basic demonstration of resize and crop </p>
<p>Image name:</p>
<p><input type="text" name="imagepath" style="width: 300px"
value="<cfoutput>#form.imagepath#</cfoutput>" /></p>
<p><input type="submit" name="submit" value="Process image" /></p>
</form>
<cfif FileExists(getAbsolutePath(form.imagepath))>
<p><img src="<cfoutput>#form.imagepath#</cfoutput>" /></p>
</cfif>
<cfif FileExists(getAbsolutePath("thumb_#form.imagepath# "))>
<p>resize: <img src="<cfoutput>thumb_#form.imagepath#</cfoutput>" /></p>
</cfif>
<cfif FileExists(getAbsolutePath("crop_#form.imagepath#" ))>
<p>crop: <img src="<cfoutput>crop_#form.imagepath#</cfoutput>" /></p>
</cfif>
</body>
</html>
Bill Guest
-
Why is "Act as part of the operating system" dangerous?
Hello everybody: I have a question: Why is "Act as part of the operating system" dangerous? I have an application that will go live on Windows... -
Windows Server 2003/IIS 6.0/ASP.NET "Could not find a part of the path"
I have an ASP.NET web application running on a load-balanced Windows Server 2003 web farm running IIS 6.0, using Active Directory authentication. ... -
Exception - Could not find a part of the path "D:\"
I've just deployed my .Net Web app at an ISP on a shared server. Whenever I try to create a new directory, an exception is raised - Could not... -
lost part of my "/usr/local"-filesystem - debian(woody)
Hi all, I inadvertently deleted part of my "/usr/local"-filesystem doing a "rm -r /usr/local". Although I stopped the command immediately when I... -
Sony DSC-F1 Video Connector?? "Battery adapter attaching part"???
Sony DSC-F1 Video Connector? What's the connector for the DSC-F1 Video Out? If I stuff in a 1/8" phone plug, I get video out. Problem is that... -
Bill #2
Re: Part 2 - Massimo's tmt_img.cfc "Anyone"
I couldn't post Part 2 as it was to large so I've uploaded the Text file.
The whole works is here [url]http://www.datapacks.com/img_CFC.txt[/url]
Thanks in advance
Bill
Bill Guest



Reply With Quote

