how to output image file from database drupal 7?
Firstly save image to your server and then you can output the image.

You can save image by using file_save_upload(). 


  file_save_upload : Saves a file upload to a new location.


$file = file_save_upload('myimage',array(), 'public://');


Get fileid(fid) of the image

$fid=$file-&gt;fid;


And then save this $fid to your database.

After it get fid from database

  $upload_record = file_load($fid);
  $url = $upload_record-&gt;uri;

  $render_image = theme(
    'image_style', 
    array(
      'style_name' =&gt; 'Style_name', 
      'path' =&gt; $url, 
      'getsize' =&gt; TRUE, 
      'attributes' =&gt; array(
        'width' =&gt; '250', 
        'height' =&gt; '162')
      )
    );


Now print $render_image variable where you want to display image.