imagecoldfusionrailocfimage

ImageScaleToFit - how to implement?


I'm new to Railo, moving away from ColdFusion 8 where my site used to used to use cfx_imagecr3.

I believe Railo has ImageScaleToFit but I'm not sure if I'm using it correctly or if I need to add some kind of class/component? I've added it between a cfscript but i get 'invalid variable declaration' which doest make any sense to me. Any help appreciated.

I'm running railo-4.0.0.013 on ubuntu 12.04

<cfscript>
        imageScaletoFit('/home/images/testimage.jpg','90','114','highestPerformance');
</cfscript>

Solution

  • You need to first load the image into a variable, then use that variable name inside ImageScaletoFit, like so:

    <cfimage name="ImgVariable" source="/home/images/testimage.jpg" />
    
    <cfset imageScaletoFit(ImgVariable,'90','114','highestPerformance') />
    

    (This isn't specific to Railo - the function exists and works the same way in CF8+)