ColdFusion Community

The online ColdFusion / CFML community website

The online ColdFusion community website. Getting CFML developers together

Videos

  • Add Videos
  • View All

Helpful Tips

Tip #3
The power of the search box. Try searching to quickly find content. The search box is in the top right of your screen.

Tip #2
You can get the latest website activity via RSS. Click here to select it.

More Tips >>
 

News from Coldfusion Bloggers

Could CF image resizing be killing your #ColdFusion server? Explanation and solutions.

Are you having slow ColdFusion pages and wondering what may be the cause? There can of course be many root causes, but a common one that I'm finding lately as I help people is due to using CF's image resizing features, such as to create thumbnails after a file is uploaded (or when many files are uploaded). Such folks may be using the CFIMAGE action="resize" tag, or the imageResize() or ImageScaleToFit() functions to do resizing. The problem (if this is the cause of a slow page) is due to a default setting for all these which may not be the best choice in all cases. The good news is that there's a quick fix, through there are some other things to consider. (If you're currently using CFIMAGE to do resizing, jump to the last section of this entry to see an example of code switching from the "slow" approach to the faster one. But really, you ought to read the rest of this entry to understand what's being proposed.) While I offer all the info here for your consideration, if you need help implementing the solution, or better understanding how to find and resolve these or other problems affecting your CF server performance, see more on my CF server troubleshooting consulting services.

Problem: Default "Interpolation" value is "highestquality"

The culprit in this particular problem is a default value in each of these for an "interpolation" level, which presupposes that you want "highestquality" (that's literally an available value for this setting). That quality seems to come at a significant performance penalty for many (which may vary depending on the type or size of file being processed, and again is multiplied the more files you're processing in a single request.)

Solution: There are alternative values for "interpolation"

So the first "good news" is that there is a range of options one can set for this interpolation value, and the opposite one is "highestperformance". For many people, changing to that value has no negative impact on quality (again, that may depend on the image, its size, what you're using the result for, etc.) but it offers a GREAT improvement in performance. You need to test for yourself.

Implementation 1: Controlling Interpolation in the CFIMAGE tag

So if you use CFIMAGE action="resize", what can you do? Well, the "bad news" is that for CF8 and CF9, the CFIMAGE tag has no means for you to affect the interpolation value. It has no INTERPOLATION attribute. Some great news is that CF10 adds this attribute (for use specifically with action="resize"), but note that the default is still "highestquality", so you will want to consider changing it. See the docs for CF10 on CFIMAGE for the range of INTERPOLATION attribute values. If you're on CF 8 or 9, though, you will need to consider changing your code to use the imageResize() function instead, which is discussed in the next section. (Note that, for now, only the action="rewrite" option for CFIMAGE makes any use of interpolation at all.)

Implementation 2: Controlling Interpolation in the imageResize() and imageScaleToFit()functions

In all three releases (CF 8, 9, and 10), the imageResize() function--and the perhaps less-well-known imageScaleToFit() function--both have an available (optional) argument for controlling the interpolation value. It's the 4th arg in both imageResize() and imageScaleToFit(). But in all three releases, the value for each again defaults to "highestquality". Specifying it as "highestperformance" (or some value between the two) again may have a noticeable effect on improving performance without much loss of image quality. See the docs on these functions (here's a link to the CF9 CFML reference.) Test things for yourself, and report here if it helps. (As an interesting aside, the docs suggest that while imageRotate(), imageShear(), and imageTranslate() functions also have an optional interploation argument, theirs each defaults to the fastest of the values they offer. One wonders why Adobe chose for resizing and scaling to opt for the opposite values.)

Changing from CFIMAGE will require reading and writing the file a new way

Finally, if you do have to change from using CFIMAGE to the imageResize() function (not required for CF10), you may also need to deal with how to load the image from disk into memory, and write it out, if you're also doing that in the one tag. CFIMAGE has both a SOURCE and DESTINATION attribute which can point to a file on disk to be read/written. The imageResize() function's does not support that. Instead, its first ("name") argument instead expects to be passed a variable with an image in it, such as is created by other CFML image-processing tags or functions. imageNew() can read an image from disk into memory. Similarly, the result of calling imageResize() is a manipulation of that image object in memory. The function has no means to write out the result. That can be done with either imageWrite() or another CFIMAGE action="write". So to change from using the tag-based resize to function-based, you may need to add a line of code to load the image from disk, such as using imageNew(), and one to write the resulting image to disk, such as using imageWrite(). Consider the following tag-based resize code, which reads, resizes, and writes out an image (available in the CFDOCS directory, if you installed that with ColdFusion): That could be re-written as either: or (for those who prefer script to tags): myImage=ImageNew("../cfdocs/images/artgallery/jeff01.jpg"); ImageResize(myImage,100,100,"highestperformance"); imageWrite(myimage,"jeff02_thumbnail.jpg"); Again, test things for yourself to determine whether changing to highestperformance results in an image quality you (and your users) can find acceptable. See the docs for a range of alternative options to consider. And if you move up to CF10, note that you can solve the problem with CFIMAGE action="rewrite" by just adding the new INTERPOLATION attribute right onto the tag. For more on the many (many) new features of CF10, check out my blog entry on the topic. And again if you need help solving these or such other problems affecting your CF server performance, let me know how I can help, via my CF server troubleshooting consulting services. Of course I welcome and encourage followup and feedback here on this particular problem. And for solutions to other such knotty CF troubleshooting challenges, see my cf911.com site of CF server troubleshooting resources.

ColdFusion 10 with Ubuntu Upstart

Setting up ColdFusion 10 on an Ubuntu Server, and as per usual, the installation option to start up ColdFusion when the server starts does work on Linux.So I wondered how hard it would be to set this up using Upstart, and it was surprisingly easy with a few bit of trial and error.This is what I would eventually came up with:Unfortunately, I would like this to respawn if it somehow does, and it doe...

Blog Posts

Mylyn Coldfusion Builder and Tasktop

Posted by Lance Knight on April 4, 2012 at 1:01 1 Comment

 

I have been using ColdFusion builder with Mylyn and Tasktop. I have found it to be quiet helpful with managing my task list. The task focusing gets me back to code quickly and can also manages my time better with the time tracking capabilites available. I would strongly recommend using ColdFusion…

Continue

How to get Domain groups in ColdFusion

Posted by Shirak Grigor on March 1, 2012 at 23:45 0 Comments

I have been struggling with cfntauthenticate to return domain groups, it is failing each time I enable listgroups. So I end up using java (JRUN API). for details please click below link

http://cf-click.blogspot.com/2012/03/how-to-get-domain-groups-in-coldfusion.html


Thanks,

Shirak

Senior developer required in South West London

Posted by Alex Skinner on February 9, 2012 at 11:34 0 Comments

We are hiring again in our London office looking for an advanced Coldfusion developer / Senior to join our team of 10 working with the goodness which is Open Bluedragon openbd.org

http://www.pixl8.co.uk/who-we-are/were-hiring.htm/senior-developer-vacancy

Working on frameworks, CMS, Intranets, Mobile apps and 3 of our SAAS products

Just In- CF Developer required with strong front end skills - SW London to 40k perm onsite ONLY

Posted by PROVEER CONSULTING Ltd on August 22, 2011 at 20:15 0 Comments

My client in South West London seeks a developer to join their established team designers and producers. Their industry is New Media Digital Marketing. Agency environment.

 

You will have strong front end skills- tech such as Html5, css. Usability.

 

For further information please email to Andy@proveer-consulting.com

vacancy number PC00101AR

Events

Photos

Loading…
  • Add Photos
  • View All
 
 
 


Latest Activity

Nick Tong posted a video
40 minutes ago
Joven Albarida is now a member of ColdFusion Community
42 minutes ago
N.Chui Eit liked Andy Jarrett's photo
Friday
CF Mitrah liked Brian Swartzfager's discussion Alpha Releases Out of Updated jQuery UI and Brand-New jQuery Enchant Libraries
Wednesday
CF Mitrah liked Lance Knight's blog post Mylyn Coldfusion Builder and Tasktop
Wednesday
Nick Tong commented on Lance Knight's blog post Mylyn Coldfusion Builder and Tasktop
"Hi Lance, where do you install Mylyn and Tasktop from?"
May 16
Lawrence Cramer and Michael Evangelista are now friends
May 16
Michael Evangelista updated their profile
May 16
Michael Evangelista and Priyank are now friends
May 16
Tarek ez and CF Mitrah are now friends
May 11
Tarek ez replied to CF Mitrah's discussion Finding a new ColdFusion job is too hard
"send me your email i will get you work."
May 11
Tarek ez liked Nick Tong's discussion ColdFusion 10 - your thoughts?
May 11

Members

Translate this page

Badge

Loading…

© 2012   Created by Nick Tong.

Badges  |  Report an Issue  |  Terms of Service