4 Replies Latest reply on Aug 8, 2010 9:18 PM by WebolutionDesigns

    CFIMAGE CFLOOP Performance

    WebolutionDesigns Level 1

      I have a site I am building that pulls large images from a folder based upon a recordset. I am using cfimage within a cfloop to go through the recordset, resize the images and add a watermark. I am experiencing performance problems. I was thinking that perhaps cfthread might be useful in this scenario, but I have not used that before. Anyone have thoughts on how to solve my performance issues?


      FYI...here is my current cfloop/cfimage code for your reference.


      <cfloop query="rsProofs">

      <!--- Read in the original image. --->

          <cfset objImage = ImageRead( "./proof/#rsProofs.FILENAME#" ) />


          <!--- Read in the Stark Images watermark. --->

          <cfset objWatermark = ImageNew( "./images/logoMain.png" ) />


          <!---Resize main image--->

          <cfimage action = "resize" height = "10%" source = "#objImage#" width = "10%" overwrite = "no" name = "objImageresize">


          <!---Resize watermark image--->

          <cfimage action = "resize" height = "75%" source = "#objWatermark#" width = "75%" overwrite = "no" name = "objWatermarkresize">


          <!---Rotate watermark--->

          <cfimage action = "rotate" angle = "-35" source="#objWatermarkresize#" overwrite="no" name="objWatermarkrotate">



              Turn on antialiasing on the existing image

              for the pasting to render nicely.


          <cfset ImageSetAntialiasing( objImageresize, "on" ) />



              When we paste the watermark onto the photo, we don't

              want it to be fully visible. Therefore, let's set the

              drawing transparency to 50% before we paste.


          <cfset ImageSetDrawingTransparency( objImageresize, 60 ) />



              Paste the watermark on to the image. We are going

              to paste this into the bottom, right corner.


          <cfset ImagePaste( objImageresize, objWatermarkrotate, 50, 0 ) />


      <!--- Write it to the browser. --->

          <p><cfimage action="writetobrowser" source="#objImageresize#" /></p>

                  <hr />