Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cfx_image sample code 1

Status
Not open for further replies.

peter11

Instructor
Mar 16, 2001
334
US
Does any one have sample code for cfx_image.

My server has the tag but no documentation on how to use it.

My goal is to upload a jpeg (or gif) and create a 100 x 100 thumbnail and a 240 x 320 regular size image.

I believe this is possible on upload but I am not sure how.

Thanks,
Jeff
 
Documentation should come with the tag. Download the tag, or a demo version if it's not free, and you'll have the documentation straight from the developer.

A Google search on cfx_image returned numerous results, and I know it's available on the MacroMedia Exchange.



Hope This Helps!

ECAR
ECAR Technologies, LLC

"My work is a game, a very serious game." - M.C. Escher
 
Here is what I use.

<cfif #form.aFile# NEQ "">
<!-- first load the photo on the server so CFX can process it -->
<cffile action="upload" filefield="aFile" destination="D:\inetpub\mysite\photos\"
ACCEPT="image/jpg, image/pjpeg, image/gif" nameconflict="MAKEUNIQUE">
<cfset file1 = #file.serverfile#>
<!-- must read the image info to see later if it is too big -->
<CFX_IMAGE name="small" ACTION="READ" FILE="D:\inetpub\mysite\photos\#file1#">
<!-- Is the photo is not a gif or pjpeg - convert it, i do this for the Flash viewer -->
<cfif #IMG_TYPE# EQ "GIF">
<cfset file1Trunc=REReplace(file1,".gif","","ONE")>
<CFX_IMAGE ACTION="CONVERT" FILE="D:\inetpub\mysite\photos\#file1#"
OUTPUT="D:\inetpub\mysite\photos\#file1Trunc#.jpg" QUALITY="100">
<CFFILE ACTION="DELETE" FILE="D:\inetpub\mysite\photos\#file1#">
<cfset file1= "#file1Trunc#.jpg" >
</CFIF>
<!-- Is the photo too big, if so resize it down -->
<CFIF #IMG_HEIGHT# GT 261>
<CFX_Image ACTION="RESIZE" FILE="D:\inetpub\mysite\photos\#file1#"
OUTPUT="D:\inetpub\mysite\photos\#file1#" QUALITY="75" Y="260">
</CFIF>
<!-- Finally insert the photo into the DB tables -->
<CFQUERY datasource="dns" >
Insert ...
</CFQUERY>
</cfif>
 
This code works but does anyone have anything prefabbed.
I have two different web pages; Photo Album and Advertisements:
Photoalbum Questions:
-I need to generate one thumbnail(75x100) and one full
(300x400) or should just make one full and resize the
thumbnail on the web page?
- how to I handle portrait vs landscape

Advertisements:
-why does the code above convert gifs to jpgs, is there a
problem with resizing gifs? Some files uploaded will be
animated gifs that cannot be converted??


Thanks--
 
I converted them to jpegs because that is all the Flash can display.
 
Ok.

Am I correct the your code will only work with one orientation type of image (ie. landscape or portrait).
It will always set the width of a image to 260, as opposed setting the width of a landscape to 260 and the height for a portrait to 260.
 
Use some conditionals.

<cfif IMG_HEIGHT gt IMG_WIDTH>
<!--- image is portrait resize accordingly--->
<cfelse>
<!--- image is landscape resize accordingly --->
</cfif>

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Is it possible to convert .tiff images into .jpg via cfx_image
 
ecar said:
Documentation should come with the tag.

I'm sure the answer is in there.

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top