how to view a BLOB (image)

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default how to view a BLOB (image)

    <cfquery datasource='dbsource' username='username' password='password'
    name='viewpic'> select image from images where id = 1 </cfquery> <cfset
    fullPath = 'C:\folder\abc.jpg'> <cfoutput query='viewpic'> <cffile
    action='write' file='#fullPath#' output='#image#' addNewLine='Yes'
    nameconflict='overwrite'> </cfoutput> <!--- to show it in the browser---->
    <cfheader name='Content-Disposition' value='inline; filename=#fullPath#'>
    <cfcontent type='image/jpeg' file='#fullPath#' deletefile='no'>

    shahzad Guest

  2. Similar Questions and Discussions

    1. Design view Image for custom tag
      Hi all, I am currently using Dreamweaver 8 and am trying to implement my own set of custom tags. In particular I have tried to create a custom...
    2. BLOB Image from Interbase in ASP
      Response.BinaryWrite the value from the recordset? Ray at work "Daniel Olivares" <danielog76@hotmail.com> wrote in message...
    3. BLOB Image fron Interbase in ASP....
      Please don't multipost. Answered elsewhere. Ray at work "Daniel Olivares" <danielog76@hotmail.com> wrote in message...
    4. determine image information on image stored in MySQL BLOB
      Hi all, I store images in my DB as BLOB. When I want to place them in an html table, I want to determine the width of the image in order to...
    5. how to show image retrieved from BLOB on the web page
      Hi, Does anyone know how to retrieve binary image data from BLOB column of SQL database table and show it on the web page. I know "img src=" tag...
  3. #2

    Default Re: how to view a BLOB (image)

    For efficiency's sake, is there a way to just send the binary image data to the
    browser without the extra I/O and the file maintenence (have to create and
    delete temp file on server=slow) of writing the BLOB data to a file as shown in
    this solution? I mean, the data is in the database, I don't need another copy
    of it on the server even temporarily. Do I really have to write (disk hit) and
    read (disk hit) then delete (disk hit) a temp file to send it is my question.

    I am now learning CF, but I have to say this was easy code in ASP. Since CF
    is "better" why all the extra I/O? I will keep reading the forum, and look
    forward to any replies.

    Thanks for the clean code example and for any additional advice on the topic.

    Roberta

    RFreese Guest

  4. #3

    Default Re: how to view a BLOB (image)

    See my post at:


    [url]http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=6&thread[/url]
    id=1015900&enterthread=y

    It shows you how to stream the image out to the browser without having to
    write it to disk.

    James
    Sacramento, CA

    unleashed Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139