|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
image manipulation in coldfusion?
Author: Webmaster at FastTrack On Line
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220531
I'm catching up on this thread, but ...
I do think CF should have image manipulation. I'm not about to go and learn
Java or anything vaguely "codey" if i can possibly help it, not enough hours
in the day and I bought CF for the very reason I would never have to learn
Java! Programming at that level just isn't for me, I find it tedious.
I have used http://www.imagemagick.org/script/index.php as
a work around
and it works just fine, and it's free :-)
Jenny
Author: Massimo Foti
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220519
> Put it out there Pete. I'd be interesting in seeing what else you added to
> it, There's a few things that I wish tmt_img did differently. All in all,
> it's a great piece of code though. Thank you Massimo.
I have a few things I would add/improve for the next version. Please feel
free to provide feedback here or contact me directly at:
massimo@massimocorner.com
----------------------------
Massimo Foti
Tools for ColdFusion and Dreamweaver developers:
http://www.massimocorner.com
----------------------------
Author: Massimo Foti
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220518
----- Excess quoted text cut - see Original Post for more -----
Thanks Roger. I am aware of this but I am still not sure on what's the best
way to handle it.
Until now I tried to leave out any form of "logic" from the CFC; in my
vision it only has to perform the basic operations, then it's up to the
developer to wrap any logic around it (see the post about conditional
cropping).
The CFC could check if the crop area exceed image's dimensions and adjust
the cropping area. I still have mixed feelings about this... It will surely
make the CFC more "monkey proof", but I don't want a component that try to
"outsmart" its user. Personally I would again, extend the CFC and add a
"saveCrop" method that just wrap the logic around the base method.
Feedback and opinions on this would be very much appreciated.
----------------------------
Massimo Foti
Tools for ColdFusion and Dreamweaver developers:
http://www.massimocorner.com
----------------------------
Author: Massimo Foti
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220517
> What I'm looking for is a way to test the size of an image before its
> displayed and then resize it if its width exceeds 250px - if 250px or
> less then it can be left alone.
>
> Not sure if tags like Massimo's support that or not.
My CFC offers all the basic functionality you need for this, but you have to
perform the logic (if exceeds crop, if not let it alone) on your own. In my
opinion the best thing to do would be to extend the CFC and put your logic
there. This would allow you to first, separate the logic from the core
functionality, then it will make easier to update as soon as I will release
an updated version of the CFC since you would not change my code directly.
----------------------------
Massimo Foti
Tools for ColdFusion and Dreamweaver developers:
http://www.massimocorner.com
----------------------------
Author: Pete Ruckelshaus
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220443
OK, most of the meat and potatoes of what I'm doing is in this
cfscript block. I'm sure that it's possible to encapsulate this in a
much neater fashion, I just chose not to.
<cfscript>
/* Set some variables that will make it easier to work with file and
server paths */
filepath = cffile.serverdirectory & "\";
imgname = cffile.serverfile;
fullImgPath = filepath & imgname;
thumbname = cffile.serverfilename & "_thumb." & cffile.serverfileext;
fullThumbPath = filepath & thumbname;
/* Invoke the image CFC */
imgObj = CreateObject("component", "lib.cfc.tmt_img");
imgObj.getDimensions("#fullImgPath#");
/* Set image width and height as variables to make them easier to work with */
imgwidth = imgObj.getwidth("#fullImgPath#");
imgheight = imgObj.getheight("#fullImgPath#");
if (imgwidth GT imgheight) {
orientation = "landscape";
} else if (imgwidth LT imgheight) {
orientation = "portrait";
} else {
orientation = "square";
}
resizewidth = imgwidth;
resizethumbwidth = maxthumbdimension;
divide_by_value = (imgheight / imgwidth);
if ((imgwidth GTE maxdimension) AND (imgheight GTE maxdimension) AND
(imgwidth GTE imgheight)) {
resizewidth = maxdimension;
resizethumbwidth = maxthumbdimension;
diagnostics = diagnostics & "Landscape, both dimensions larger than
max.<br>";
resize = "true";
} else if ((imgwidth GTE maxdimension) AND (imgheight GTE
maxdimension) AND (imgwidth LTE imgheight)) {
resizewidth = (maxdimension / divide_by_value);
resizewidth = round(resizewidth);
resizethumbwidth = (maxthumbdimension / divide_by_value);
resizethumbwidth = round(resizethumbwidth);
diagnostics = diagnostics & "Portrait, both dimensions larger than
max.<br>";
resize = "true";
} else if ((imgwidth GTE maxdimension) AND (imgheight LTE maxdimension)) {
resizewidth = maxdimension;
resizethumbwidth = maxthumbdimension;
diagnostics = diagnostics & "Landscape, width greater than max,
height less than max.<br>";
resize = "true";
} else if ((imgwidth LTE maxdimension) AND (imgheight GTE maxdimension)) {
resizewidth = (maxdimension / divide_by_value);
resizewidth = round(resizewidth);
resizethumbwidth = (maxthumbdimension / divide_by_value);
resizethumbwidth = round(resizethumbwidth);
diagnostics = diagnostics & "Portrait, width less than max, height
greater than max.<br>";
resize = "true";
} else {
diagnostics = diagnostics & "Both dimensions smaller than max.
[ELSE]<br>";
resize = "false";
/* Image is smaller than the maxdimension in both dimensions.
It won't resize the image, but what about sizing the thumbnail? */
if ((imgwidth GTE maxthumbdimension) AND (imgheight LTE maxthumbdimension)) {
/* */
resizewidth = imgwidth;
resizethumbwidth = maxthumbdimension;
diagnostics = diagnostics & "Landscape, larger than thumbmax but
smaller than max.<br>";
resize = "true";
} else if ((imgwidth LTE maxthumbdimension) AND (imgheight GTE
maxthumbdimension)) {
resizewidth = imgwidth;
resizethumbwidth = (maxthumbdimension / divide_by_value);
diagnostics = diagnostics & "Portrait, larger than thumbmax but
smaller than max.<br>";
resize = "true";
} else {
/* Image smaller than thumbnail in both dimensions.
Don't create new thumbnail. */
diagnostics = diagnostics & "Smaller than thumbmax. [ELSE]<br>";
resize = "false";
}
}
/* Doublecheck the portrait/resizewidth = maxthumbdimension bug */
if ((orientation EQ "portrait") AND (resizethumbwidth EQ maxthumbdimension)) {
resizethumbwidth = (maxthumbdimension / divide_by_value);
/* diagnostics = diagnostics & "Bug trapped!<br>"; */
}
if (resize EQ "true") {
/* Scale down large images using the resizewidth value */
imgObj.resize(fullImgPath, "#fullImgPath#", resizewidth);
imgObj.resize(fullImgPath, "#fullThumbPath#", resizethumbwidth);
diagnostics = diagnostics & "Resize true, Image and thumbnail
created.<br>";
} else if ((imgwidth LT maxthumbdimension) AND (imgheight LT
maxthumbdimension)) {
imgObj.resize(fullImgPath, "#fullThumbPath#", imgwidth);
diagnostics = diagnostics & "Resize false, Image and thumbnail
created.<br>";
} else {
imgObj.resize(fullImgPath, "#fullThumbPath#", resizethumbwidth);
diagnostics = diagnostics & "Resize false, but creating a properly
sized thumbnail. [ELSE]<br>";
}
</cfscript>
If this isn't enough, I can make a zipped copy of the CFM template available.
Pete
Author: Bryan Stevenson
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220360
> ImageCR3 does that impeccably. When specifying dimensions for the resize
> you put >250x>100 and it will resize the width down to 250 if greater
> and/or the height down to 100 is greater than 100 with prefect quality
> results.
as does mine....look at the scaleBy attribute....ensures that dimension is
within given size limit
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: bryan@electricedgesystems.com
web: www.electricedgesystems.com
Author: Bryan Stevenson
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220359
Well ya weren't following that close Kevin....I posted CFC methods to check
image dimensions AND another to re-size....a couplde of CFIFs and those will
get ya what ya want ;-)
Cheers
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: bryan@electricedgesystems.com
web: www.electricedgesystems.com
Author: Andy Matthews
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220306
Put it out there Pete. I'd be interesting in seeing what else you added to
it, There's a few things that I wish tmt_img did differently. All in all,
it's a great piece of code though. Thank you Massimo.
<!----------------//------
andy matthews
web developer
ICGLink, Inc.
andy@icglink.com
615.370.1530 x737
--------------//--------->
It didn't, but I wrote an app on top of tmt_img that does it. If
you're interested in my code, shoot me an email. I also extended
tmt_img a bit.
Pete
Author: Andy Matthews
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220302
Massimo's tag has getHeight and getWidth methods. Call those on an image,
then check accordingly.
<!----------------//------
andy matthews
web developer
ICGLink, Inc.
andy@icglink.com
615.370.1530 x737
--------------//--------->
Thanks guys - I've been following this with interest as I have a
particular resizing challenge at the moment.
What I'm looking for is a way to test the size of an image before its
displayed and then resize it if its width exceeds 250px - if 250px or
less then it can be left alone.
Not sure if tags like Massimo's support that or not.
Any suggestions please.
++++++++++
Kevin Parker
Web Services Consultant
WorkCover Corporation
p: 08 8233 2548
m: 0418 806 166
e: kparker@workcover.com
w: www.workcover.com
++++++++++
> That's what I tried to do when
> I wrote version 2.0 of my CFC and I achieved a huge increase in
quality.
Massimo: Just to let you know... I was playing around with your CFC, and
noticed that on some images (usually horizontally oriented ones),
bufferedCrop() would throw an "outside of raster" error. I was able to
fix it by modifying the code to check for crop operations that exceed
the height of the image.
With that said, thanks for putting the code out there.
--
Roger Benningfield
http://admin.support.journurl.com/
http://admin.mxblogspace.journurl.com/
Author: Pete Ruckelshaus
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220296
It didn't, but I wrote an app on top of tmt_img that does it. If
you're interested in my code, shoot me an email. I also extended
tmt_img a bit.
Pete
Author: Martin Parry
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220288
ImageCR3 does that impeccably. When specifying dimensions for the resize
you put >250x>100 and it will resize the width down to 250 if greater
and/or the height down to 100 is greater than 100 with prefect quality
results.
Martin
http://www.beetrootstreet.com
Thanks guys - I've been following this with interest as I have a
particular resizing challenge at the moment.
What I'm looking for is a way to test the size of an image before its
displayed and then resize it if its width exceeds 250px - if 250px or
less then it can be left alone.
Not sure if tags like Massimo's support that or not.
Any suggestions please.
++++++++++
Kevin Parker
Web Services Consultant
WorkCover Corporation
p: 08 8233 2548
m: 0418 806 166
e: kparker@workcover.com
w: www.workcover.com
++++++++++
> That's what I tried to do when
> I wrote version 2.0 of my CFC and I achieved a huge increase in
quality.
Massimo: Just to let you know... I was playing around with your CFC, and
noticed that on some images (usually horizontally oriented ones),
bufferedCrop() would throw an "outside of raster" error. I was able to
fix it by modifying the code to check for crop operations that exceed
the height of the image.
With that said, thanks for putting the code out there.
--
Roger Benningfield
http://admin.support.journurl.com/
http://admin.mxblogspace.journurl.com/
Author: Parker, Kevin
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220287
Thanks guys - I've been following this with interest as I have a
particular resizing challenge at the moment.
What I'm looking for is a way to test the size of an image before its
displayed and then resize it if its width exceeds 250px - if 250px or
less then it can be left alone.
Not sure if tags like Massimo's support that or not.
Any suggestions please.
++++++++++
Kevin Parker
Web Services Consultant
WorkCover Corporation
p: 08 8233 2548
m: 0418 806 166
e: kparker@workcover.com
w: www.workcover.com
++++++++++
> That's what I tried to do when
> I wrote version 2.0 of my CFC and I achieved a huge increase in
quality.
Massimo: Just to let you know... I was playing around with your CFC, and
noticed that on some images (usually horizontally oriented ones),
bufferedCrop() would throw an "outside of raster" error. I was able to
fix it by modifying the code to check for crop operations that exceed
the height of the image.
With that said, thanks for putting the code out there.
--
Roger Benningfield
http://admin.support.journurl.com/
http://admin.mxblogspace.journurl.com/
Author: Roger B.
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220286
> That's what I tried to do when
> I wrote version 2.0 of my CFC and I achieved a huge increase in quality.
Massimo: Just to let you know... I was playing around with your CFC,
and noticed that on some images (usually horizontally oriented ones),
bufferedCrop() would throw an "outside of raster" error. I was able to
fix it by modifying the code to check for crop operations that exceed
the height of the image.
With that said, thanks for putting the code out there.
--
Roger Benningfield
http://admin.support.journurl.com/
http://admin.mxblogspace.journurl.com/
Author: Bryan Stevenson
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220137
> I've checked out your code. It's great. We just use ImageCR for the
> broad
> filetype support.
yep...mine is great for good old JPG/GIF manip....but when ya hit the TIFFs
it gets fuzzy....BTW I do have some code to convert multi-page TIFFs to PDF
(one page per page in TIFF)....compliments of the wonderous package iText
;-)
Cheers
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: bryan@electricedgesystems.com
web: www.electricedgesystems.com
Author: Emmet McGovern
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220136
Sorry Bryan ;)
I've checked out your code. It's great. We just use ImageCR for the broad
filetype support.
-e
> We use imageCR3 and love it. I only wish it was java based so we could
> use
> it on linux.
>
> -e
Once again....my code is Java based and FREE (not as sophisticated as
imageCR3....but original poster doesn't need the fancy stuff)
OK...I'm done talking to myself ;-)
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: bryan@electricedgesystems.com
web: www.electricedgesystems.com
Author: Massimo Foti
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220134
> How is the quality on the resizes for that? I've used some java stuff
> like that before and had issues with the quality.
You can use Java for image manipulation and achieve good quality results.
You just have to dig the APIs a little more. That's what I tried to do when
I wrote version 2.0 of my CFC and I achieved a huge increase in quality.
You can get it from here and give it a try (it's free):
http://www.olimpo.ch/tmt/cfc/tmt_img/
----------------------------
Massimo Foti
Tools for ColdFusion and Dreamweaver developers:
http://www.massimocorner.com
----------------------------
Author: Burns, John D
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220135
Bryan,
How is the quality on the resizes for that? I've used some java stuff
like that before and had issues with the quality. Things seemed to come
out a little distorted. From what I can see in the component, it doesn't
seem like there's any kind of argument for the quality. Let me know if
you've had similar experiences. For some of the people I've tried doing
this for, they're artists and bands and people who are a little more
particular about the resize quality so I really need it to be top notch.
Let me know.
John Burns
Certified Advanced ColdFusion MX Developer
Wyle Laboratories, Inc. | Web Developer
.....and for those that care (Tony got his offlist)....here's the FREE
code I was on about yesterday.....enjoy!!
Author: Bryan Stevenson
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220133
Hey John,
I haven't noticed any quality issues....also haven't used it with super high
res images....
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: bryan@electricedgesystems.com
web: www.electricedgesystems.com
Author: Burns, John D
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220132
Bryan,
How is the quality on the resizes for that? I've used some java stuff
like that before and had issues with the quality. Things seemed to come
out a little distorted. From what I can see in the component, it doesn't
seem like there's any kind of argument for the quality. Let me know if
you've had similar experiences. For some of the people I've tried doing
this for, they're artists and bands and people who are a little more
particular about the resize quality so I really need it to be top notch.
Let me know.
John Burns
Certified Advanced ColdFusion MX Developer
Wyle Laboratories, Inc. | Web Developer
.....and for those that care (Tony got his offlist)....here's the FREE
code I was on about yesterday.....enjoy!!
<!---(Function:
ThumbIt)------------------------------------------------------
Date Created: December 1, 2003
Author: Bryan
Arguments: FileLoc - full path of image to be thumbnailed
(string)
required
ThumbPrefix - string to append to the filename to name
the thumbnail (string) not required
ScaleBy - which dimension to scale by "W or H"
(string) required
ScaleValue - the measurement of the dimension
specified in ScaleBy to use to calculate proper scale (string) required
Purpose: shrink an image
Returns: N/A
--->
<cffunction name="ThumbIt" access="public">
<cfargument name="FileLoc" type="string" required="Yes">
<cfargument name="ThumbPrefix" type="string"required="No"
default="">
<cfargument name="ScaleBy" type="string" required="Yes">
<cfargument name="ScaleValue" type="string"required="Yes">
<cfset jFileIn =
createObject("java","java.io.File").init(ARGUMENTS.FileLoc)>
<!--- build new file loc and name --->
<cfset DirPath = GetDirectoryFromPath(ARGUMENTS.FileLoc)>
<cfset FileName = GetFileFromPath(ARGUMENTS.FileLoc)>
<cfset ThumbFileLoc = DirPath & ARGUMENTS.ThumbPrefix & FileName>
<cfset jFileOut =
createObject("java","java.io.File").init(ThumbFileLoc)>
<!--- set dimiensions --->
<cfset inBufferedImg =
createObject("java","javax.imageio.ImageIO").read(jFileIn)>
<cfset ImgWidth = inBufferedImg.getWidth()>
<cfset ImgHeight = inBufferedImg.getHeight()>
<!--- calculate scale --->
<cfif UCase(ARGUMENTS.ScaleBy) eq "W">
<cfset Scale = ARGUMENTS.ScaleValue / ImgWidth>
<cfelseif UCase(ARGUMENTS.ScaleBy) eq "H">
<cfset Scale = ARGUMENTS.ScaleValue / ImgHeight>
</cfif>
<!--- define thumbnail dimensions --->
<cfset ScaledWidth = (Scale * ImgWidth)>
<cfset ScaledHeight = (Scale * ImgHeight)>
<!--- create image output --->
<cfset outBufferedImg =
createObject("java","java.awt.image.BufferedImage").init(JavaCast("int",
ScaledWidth), JavaCast("int", ScaledHeight), JavaCast("int", 1))>
<!--- create the AffineTransform --->
<cfset jTransform =
createObject("java","java.awt.geom.AffineTransform").init()>
<cfset temp = jTransform.Scale(Scale, Scale)>
<!--- initialize a Graphics2D object --->
<cfset jGraphics2D = outBufferedImg.createGraphics()>
<!--- draw the thumbnail --->
<cfset temp = jGraphics2D.drawRenderedImage(inBufferedImg,
jTransform)>
<cfset temp = jGraphics2D.dispose()>
<!--- write the thumbnail image to disk --->
<cfset fileWritten =
createObject("java","javax.imageio.ImageIO").write(outBufferedImg,
"jpg", jFileOut)>
</cffunction>
<!---(Function:
ImageSize)------------------------------------------------------
Date Created: November 28, 2003
Author: Bryan
Arguments: FileLoc - full path of image to get details for
(string)
required
Purpose: returns file width/height
Returns: ImageInfo structure with ImgWidth/ImgHeight keys
--->
<cffunction name="ImageSize" returnType="struct" access="public">
<cfargument name="FileLoc" type="string" required="Yes">
<cfset jFileIn =
createObject("java","java.io.File").init(ARGUMENTS.FileLoc)>
<cfset ImageInfo = StructNew()>
<cfset ImageObject =
createObject("java","javax.imageio.ImageIO").read(jFileIn)>
<cfset ImageInfo.ImgWidth = ImageObject.getWidth()>
<cfset ImageInfo.ImgHeight = ImageObject.getHeight()>
<cfreturn ImageInfo>
</cffunction>
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: bryan@electricedgesystems.com
web: www.electricedgesystems.com
Author: Bryan Stevenson
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220128
....and for those that care (Tony got his offlist)....here's the FREE code I
was on about yesterday.....enjoy!!
<!---(Function:
ThumbIt)------------------------------------------------------
Date Created: December 1, 2003
Author: Bryan
Arguments: FileLoc - full path of image to be thumbnailed (string)
required
ThumbPrefix - string to append to the filename to name the
thumbnail (string) not required
ScaleBy - which dimension to scale by "W or H" (string)
required
ScaleValue - the measurement of the dimension specified in
ScaleBy to use to calculate proper scale (string) required
Purpose: shrink an image
Returns: N/A
--->
<cffunction name="ThumbIt" access="public">
<cfargument name="FileLoc" type="string" required="Yes">
<cfargument name="ThumbPrefix" type="string"required="No" default="">
<cfargument name="ScaleBy" type="string" required="Yes">
<cfargument name="ScaleValue" type="string"required="Yes">
<cfset jFileIn =
createObject("java","java.io.File").init(ARGUMENTS.FileLoc)>
<!--- build new file loc and name --->
<cfset DirPath = GetDirectoryFromPath(ARGUMENTS.FileLoc)>
<cfset FileName = GetFileFromPath(ARGUMENTS.FileLoc)>
<cfset ThumbFileLoc = DirPath & ARGUMENTS.ThumbPrefix & FileName>
<cfset jFileOut =
createObject("java","java.io.File").init(ThumbFileLoc)>
<!--- set dimiensions --->
<cfset inBufferedImg =
createObject("java","javax.imageio.ImageIO").read(jFileIn)>
<cfset ImgWidth = inBufferedImg.getWidth()>
<cfset ImgHeight = inBufferedImg.getHeight()>
<!--- calculate scale --->
<cfif UCase(ARGUMENTS.ScaleBy) eq "W">
<cfset Scale = ARGUMENTS.ScaleValue / ImgWidth>
<cfelseif UCase(ARGUMENTS.ScaleBy) eq "H">
<cfset Scale = ARGUMENTS.ScaleValue / ImgHeight>
</cfif>
<!--- define thumbnail dimensions --->
<cfset ScaledWidth = (Scale * ImgWidth)>
<cfset ScaledHeight = (Scale * ImgHeight)>
<!--- create image output --->
<cfset outBufferedImg =
createObject("java","java.awt.image.BufferedImage").init(JavaCast("int",
ScaledWidth), JavaCast("int", ScaledHeight), JavaCast("int", 1))>
<!--- create the AffineTransform --->
<cfset jTransform =
createObject("java","java.awt.geom.AffineTransform").init()>
<cfset temp = jTransform.Scale(Scale, Scale)>
<!--- initialize a Graphics2D object --->
<cfset jGraphics2D = outBufferedImg.createGraphics()>
<!--- draw the thumbnail --->
<cfset temp = jGraphics2D.drawRenderedImage(inBufferedImg, jTransform)>
<cfset temp = jGraphics2D.dispose()>
<!--- write the thumbnail image to disk --->
<cfset fileWritten =
createObject("java","javax.imageio.ImageIO").write(outBufferedImg, "jpg",
jFileOut)>
</cffunction>
<!---(Function:
ImageSize)------------------------------------------------------
Date Created: November 28, 2003
Author: Bryan
Arguments: FileLoc - full path of image to get details for (string)
required
Purpose: returns file width/height
Returns: ImageInfo structure with ImgWidth/ImgHeight keys
--->
<cffunction name="ImageSize" returnType="struct" access="public">
<cfargument name="FileLoc" type="string" required="Yes">
<cfset jFileIn =
createObject("java","java.io.File").init(ARGUMENTS.FileLoc)>
<cfset ImageInfo = StructNew()>
<cfset ImageObject =
createObject("java","javax.imageio.ImageIO").read(jFileIn)>
<cfset ImageInfo.ImgWidth = ImageObject.getWidth()>
<cfset ImageInfo.ImgHeight = ImageObject.getHeight()>
<cfreturn ImageInfo>
</cffunction>
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: bryan@electricedgesystems.com
web: www.electricedgesystems.com
Author: cftalk
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220127
The personal/non-commercial "version" differs only by license.
You get the same download and binary as commercial customers.
You can upgrade to a commercial license for the difference in
cost between these license types. The same upgrade policy applies
for upgrades to future versions of ImageCR, eg. ImageCR4.
--
CrystalM
----- Excess quoted text cut - see Original Post for more -----
Author: Burns, John D
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220126
If there a difference in quality or control in the personal version vs.
the full version? Or just the license? I'm only looking at using this
for a personal site right now but may expand it later. Is there a way to
"upgrade" the license to the full version or would I just have to buy
from scratch?
John Burns
Certified Advanced ColdFusion MX Developer
Wyle Laboratories, Inc. | Web Developer
ImageCR3:
http://efflare.com/products/cfx_imagecr/
Personal licenses for $75:
http://efflare.com/purchase/?personal
We never gave it away for free, but we have plenty of happy customers.
It is optimized native code, like important parts of Java. High quality
output and extensive image format support.
If CF user groups want a license, send me a mail.
--
CrystalM
> So I'm wondering what some of you use to manipulate images in CF. I've
> been wanting something like this for a while but it's always gotten
put off.
----- Excess quoted text cut - see Original Post for more -----
Author: Andy Matthews
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220118
Bryan...
The HoF site is down. Care to share that code via email or a straight link?
<!----------------//------
andy matthews
web developer
ICGLink, Inc.
andy@icglink.com
615.370.1530 x737
--------------//--------->
> We use imageCR3 and love it. I only wish it was java based so we could
> use
> it on linux.
>
> -e
Once again....my code is Java based and FREE (not as sophisticated as
imageCR3....but original poster doesn't need the fancy stuff)
OK...I'm done talking to myself ;-)
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: bryan@electricedgesystems.com
web: www.electricedgesystems.com
Author: kola.oyedeji
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220117
That is the question :) if your host is happy to install it then its not a
problem , if he is or you are on Linux then you will probably better off
using one of the free alternatives such as Bryan's (some one was listening
;-)) or the Alagad image component which I've also heard great things about.
Kola
HTH
----- Excess quoted text cut - see Original Post for more -----
Author: Tim Laureska
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220115
Anyone have imageCR3 setup on a shared hosting environment?
+3 I have used imageCR3 and the quality is awesome, that said as others
have
pointed out it does require a dll/cfx to be installed
Kola
----- Excess quoted text cut - see Original Post for more -----
No
> > custom tags to install (which may not be a big issue unless you're
in
----- Excess quoted text cut - see Original Post for more -----
Author: kola.oyedeji
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220113
+3 I have used imageCR3 and the quality is awesome, that said as others have
pointed out it does require a dll/cfx to be installed
Kola
----- Excess quoted text cut - see Original Post for more -----
Author: Matthew Small
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220112
Yes, yes, yes - use ImageCR3 if you have the chance. I was going to
recommend it myself. I'm sure I haven't seen them all, but ImageCR3 looks
FAR better than any other resizing tag out there. I don't know how they do
it, but they do it well.
Matthew Small
Web Developer
American City Business Journals
704-973-1045
msmall@amcity.com
ImageCR3:
http://efflare.com/products/cfx_imagecr/
Personal licenses for $75:
http://efflare.com/purchase/?personal
We never gave it away for free, but we have plenty
of happy customers. It is optimized native code,
like important parts of Java. High quality output
and extensive image format support.
If CF user groups want a license, send me a mail.
--
CrystalM
> So I'm wondering what some of you use to manipulate images in CF. I've
been
----- Excess quoted text cut - see Original Post for more -----
Author: Pete Ruckelshaus
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220097
I use Massimo's tmt_img 2.0 (http://www.olimpo.ch/tmt/cfc/tmt_img/)
and it's great if what you need to do is crp/resize images. It's all
CFC so no custom tags, nothing to configure. Oh, and it's free.
I extended it to add a "max size" that resizes so that no dimension is
greater than the passed in value, which makes it even more invaluable
for me.
Pete
Author: Bryan Stevenson
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220093
> We use imageCR3 and love it. I only wish it was java based so we could
> use
> it on linux.
>
> -e
Once again....my code is Java based and FREE (not as sophisticated as
imageCR3....but original poster doesn't need the fancy stuff)
OK...I'm done talking to myself ;-)
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: bryan@electricedgesystems.com
web: www.electricedgesystems.com
Author: Emmet McGovern
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220089
We use imageCR3 and love it. I only wish it was java based so we could use
it on linux.
-e
now i'm torn.
I've used ImageCR3 in the past and yes, it's a great product with
absolutely fantastic (FANTASTIC) support.
But what I like about Alagad is the fact that it's a straight CFC. No
custom tags to install (which may not be a big issue unless you're in
a shared environment and the host likes to charge for custom tag
installations).
On 10/4/05, cftalk@efflare.com <cftalk@efflare.com> wrote:
----- Excess quoted text cut - see Original Post for more -----
been
> > wanting something like this for a while but it's always gotten put off.
> >
> > At the very least I need to be able to resize images and get their
height
----- Excess quoted text cut - see Original Post for more -----
Author: Alan Rother
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220088
Wow... yeah...
Alagad is nice, but the stuff from eFFlare is awesome.
If you are in a shared envirnment I would go with alagad.
----- Excess quoted text cut - see Original Post for more -----
Author: Bryan Stevenson
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220078
----- Excess quoted text cut - see Original Post for more -----
Charlie...buddy....find my code in the archives...straight CFC...and
FREE...I can only try and help so much!! ;-)
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: bryan@electricedgesystems.com
web: www.electricedgesystems.com
Author: Charlie Griefer
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220077
now i'm torn.
I've used ImageCR3 in the past and yes, it's a great product with
absolutely fantastic (FANTASTIC) support.
But what I like about Alagad is the fact that it's a straight CFC. No
custom tags to install (which may not be a big issue unless you're in
a shared environment and the host likes to charge for custom tag
installations).
On 10/4/05, cftalk@efflare.com <cftalk@efflare.com> wrote:
----- Excess quoted text cut - see Original Post for more -----
Author: cftalk
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220075
ImageCR3:
http://efflare.com/products/cfx_imagecr/
Personal licenses for $75:
http://efflare.com/purchase/?personal
We never gave it away for free, but we have plenty
of happy customers. It is optimized native code,
like important parts of Java. High quality output
and extensive image format support.
If CF user groups want a license, send me a mail.
--
CrystalM
----- Excess quoted text cut - see Original Post for more -----
Author: Raymond Camden
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220073
I'll ditto Alagad. It's only like 75 bucks and well worth the price.
Yes, there are free alternatives, but this one is so easy and simple
to use, I'd still recommend it.
----- Excess quoted text cut - see Original Post for more -----
Author: Joe Rinehart
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220068
I'd check out the Alagad Image Component at www.alagad.com - it's
native CF. While it's not free, it's so cheap that you'll make back
the dough the first time you use it in terms of time saved.
-Joe
----- Excess quoted text cut - see Original Post for more -----
Author: Rick Root
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220067
Andy Matthews wrote:
> So I'm wondering what some of you use to manipulate images in CF. I've been
> wanting something like this for a while but it's always gotten put off.
>
> At the very least I need to be able to resize images and get their height
> and width. More than that would be nice, but not necessary.
I use built in java stuff to do this with jpegs .. take a look at the
image.cfc file included in the CFFM distributino (www.webworksllc.com/cffm)
rick
Author: Bryan Stevenson
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220066
search the archives for my name or e-mail and "ThumbIt" or mabye "image
manipulation". I've posted my CFC methods that use Java to resize images
and get image pixel height/width about 5-10 times now....does not work with
TIFFs
I don't have the code handy right now or I'd post it yet again ;-)
Cheers
Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: bryan@electricedgesystems.com
web: www.electricedgesystems.com
Author: Charlie Griefer
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220065
not free, but i'd highly recommend the alagad image component.
http://www.alagad.com/
----- Excess quoted text cut - see Original Post for more -----
Author: Andy Matthews
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:42585#220064
So I'm wondering what some of you use to manipulate images in CF. I've been
wanting something like this for a while but it's always gotten put off.
At the very least I need to be able to resize images and get their height
and width. More than that would be nice, but not necessary.
Can anyone offer any suggestions?
<!----------------//------
andy matthews
web developer
ICGLink, Inc.
andy@icglink.com
615.370.1530 x737
--------------//--------->
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||