Skip to main content
v.jothirajan
Participant
March 8, 2017
Answered

Resize images without saving anywhere in the server

  • March 8, 2017
  • 1 reply
  • 755 views

Is there a way in ColdFusion to resize images to a specific size and show them in browser, without a need to store the resized images in folder. So the concept is only storing the original image file and show the other (resized) images without storing any where in the server.

Any help!!

    This topic has been closed for replies.
    Correct answer haxtbh

    Have a look at the cfimage documentation - ColdFusion Help | cfimage

    If gives an exact example of what you need.

    writeToBrowser action Use the writeToBrowseraction to display one or more ColdFusion images directly to the browser without writing them to files. Images are displayed in PNG format. The following example shows how to reduce the size of an image and display it in the browser:

    <!--- This example shows how to create a ColdFusion image from a JPEG file, resize it, and

    then display it in the browser as a PNG image. --->

    <cfimage source="../cfdocs/images/artgallery/jeff05.jpg" action="resize"

    width="50%" height="50%" name="smLogo">

    <cfimagesource="#smLogo#"action="writeToBrowser">

    1 reply

    haxtbhCorrect answer
    Inspiring
    March 8, 2017

    Have a look at the cfimage documentation - ColdFusion Help | cfimage

    If gives an exact example of what you need.

    writeToBrowser action Use the writeToBrowseraction to display one or more ColdFusion images directly to the browser without writing them to files. Images are displayed in PNG format. The following example shows how to reduce the size of an image and display it in the browser:

    <!--- This example shows how to create a ColdFusion image from a JPEG file, resize it, and

    then display it in the browser as a PNG image. --->

    <cfimage source="../cfdocs/images/artgallery/jeff05.jpg" action="resize"

    width="50%" height="50%" name="smLogo">

    <cfimagesource="#smLogo#"action="writeToBrowser">

    v.jothirajan
    Participant
    March 8, 2017

    That worked for me !!

    Resize and show in browser without a need to save in folder, but it will get stored in a temp folder like this CFFileServlet/_cf_image if so it will consume more space?    

    Inspiring
    March 8, 2017

    It wont consume much space as its only a temporary place. The image will be there for a short time (around 5 mins) then disappear.