I don't think the problem is with the function(s).  It actually works great on 
the first few uses, but it degrades on subsequent uses. After an hour or so, it 
works great again. I can only assume it's eating up memory and not cleaning up 
after each use... anything I can do about that?



        <cffunction name="crescendo_custom_full" returntype="any" 
access="public" output="false">
                <cfargument name="tempImage_name" type="string" required="true" 
/> <!--- name of temp image file --->
                <cfargument name="finalImage_name" type="string" 
required="true" /> <!--- name of the final image file --->
                <cfargument name="tempImage_width" type="string" 
required="true" /> 
                <cfargument name="tempImage_height" type="string" 
required="true" /> 
                <cfargument name="rootpath" type="string" required="true" /> 
<!--- name of the final image file --->
                <cfset tempImage_path="#rootpath#\assets\project_gallery\temp">
                <cfset fullImage_max_width=300>
                  <cfset fullImage_max_height=188>
                  <cfset 
fullImage_path="#rootpath#\assets\project_gallery\tmb_full">
                
                <!--- BUILD FULL IMAGE --->
                <cfset 
newfullImage=ImageRead("#tempImage_path#\#tempImage_name#")>
                <cfset scale_width=0>
                <cfset scale_height=0>
                <cfset w_scaling=tempImage_width/fullImage_max_width>
                <cfset h_scaling=tempImage_height/fullImage_max_height>

                <cfif w_scaling gt h_scaling>
                        <cfset scale_height=1>
                <cfelseif h_scaling gt w_scaling>
                        <cfset scale_width=1>
                </cfif>

                <!--- resize image to limit image --->
                <cfif scale_width eq 1 or scale_height eq 1>
                        <cfif scale_width eq 1>
                        <cfset 
ImageScaletoFit(newfullImage,fullImage_max_width,"","highPerformance")>
                        <cfelseif scale_height eq 1>
                        <cfset 
ImageScaletoFit(newfullImage,"",fullImage_max_height,"highPerformance")>
                        </cfif>
                </cfif>
                
                <cfset curHeight=ImageGetHeight(newfullImage)>
                <cfset curWidth=ImageGetWidth(newfullImage)>
                <cfif scale_width eq 1>
                        <cfset yCrop=Fix(curHeight-fullImage_max_height)/2>
                        <cfset ImageCrop(newfullImage, 0, yCrop, curWidth, 
fullImage_max_height)>
                <cfelseif scale_height eq 1>
                        <cfset xCrop=Fix(curWidth-fullImage_max_width)/2>
                        <cfset ImageCrop(newfullImage, xCrop, 0, 
fullImage_max_width, curHeight)>
                </cfif>

        <cfimage action="write" source="#newfullImage#" 
destination="#fullImage_path#\#finalImage_name#" overwrite="yes" quality=".75">
                <cfset newfullImage="">
                <!--- end build full image --->
        </cffunction>   

Robert Harrison
Director of Interactive Services

Austin & Williams
Advertising I Branding I Digital I Direct
125 Kennedy Drive,  Suite 100   I  Hauppauge, NY 11788 T 631.231.6600 X 119   F 
631.434.7022 http://www.austin-williams.com

Blog:      http://www.austin-williams.com/blog
Twitter:  http://www.twitter.com/austin_



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355888
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to