3 Replies Latest reply on May 23, 2007 7:01 AM by insuractive

    display Blog Image from sql

      I need a little help with displaying images from sql server "image data type"

      i have two files, but I still get broken links.

        • 1. Re: display Blog Image from sql
          insuractive Level 3
          Try placing the <cfsetting enablecfoutputonly="Yes"> at the top of your page to prevent any leading whitespace.
          • 2. Re: display Blog Image from sql
            vncntj Level 1
            i tried that I'm still getting the broken links
            • 3. Re: display Blog Image from sql
              insuractive Level 3
              A few thoughts -
              1) Make sure you combine both <cfsetting> tags - <cfsetting enablecfoutputonly="Yes" showdebugoutput="No"> its possible that the second tag is overwriting the settings from the first one.

              2) If your query is only returning 1 row, don't use <cfoutput query="EmpLn">#myField#</cfoutput>. instead use <cfoutput>#myQuery.myField#</cfoutput>

              3) I would recommend using <cfqueryparam> in your initial query - it should speed things up a little and help you prevent Cross Site Scripting or SQL injection:
              SELECT Blob_Segment * FROM GA_BLOB WHERE ID = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#ID#">

              4) If you are only returning 1 field from your query, I would avoid using Select * and just go ahead and specify the fields you want to return. Again, this will speed up your query

              5) In your code you are looping over the query EmpLn, but you are then trying to display getBlob.Blob_Segment - shouldn't it be EmpLn.Blob_Segment?

              6) Have you tried bringing up photo.cfm?ID=#ID# in a browser window to make sure you are not getting any CF errors?

              7) If you have checked everything else, perhaps there is a problem with how you are encoding/decoding the image blob. Are you sure you need to convert to binary, then string?

              Anyway, hopefully one of those sets you in the right direction.