12 Replies Latest reply: Mar 31, 2012 3:01 PM by -==cfSearching==- RSS

    BLOB Images in and out of Oracle

    Glowball Community Member

      Hi all, I'm using CF8 and storing images in Oracle as BLOB datatypes.  I am not able to use CF to write files to the file server.  I have about 50 large images already stored that need to have thumbnails made of them and stored in another field in each record.  So, I need to do this:

       

      1. Pull the BLOB out of the database.
      2. Make it a CF image.
      3. Resize the image.
      4. Make the new image a BLOB.
      5. Put the new BLOB in the database.

       

      The issue I'm having is that when an image starts out as a BLOB it doesn't seem to know the file type, so when I try to do step 5, above, I get "Verify your inputs. The source file should contain an extension,so that ColdFusion can determine the image format."  It seems that if I start with an actual file in step 1 it works, but not if it's binary to start.  This is my basic code edited for clarity.

       

      <cfset thisImage = ImageNew(get.file_binary)>

      <cfset ImageResize(thisImage, "500", "", "mediumQuality")>

      <cfquery name="update" datasource="#dsn#">

              UPDATE images

              SET file_binary_thumbnail = #ImageGetBlob(thisImage)#

              WHERE image_id = #get.image_id#

      </cfquery>

       

      Any idea how to get this to work?  Thanks, everyone!