title: Sending an image through JSON data
body: <p>noobie here hope you guys don't mind! Im trying to query my user/id/pictures.json but all it returns are attributes cus i did a generic format.json {render :json => @photo.to_json()}. My question is how can i create and encapsulate the actual data from the images, so my client can turn that data in to an image? And also what do i need to create(attribute wise) besides the path of image(say you only had useless attributes eg: height content_type, description, thumbnail file_name)?</p>
  
  <p>this is what im trying in my index.json.erb so far</p>
  
  <pre><code>}
    &lt;% @photos.each do |photo|%&gt;
     data: &lt;%= StringIO.new(Base64.encode64(photo.public_filename(:large))) %&gt;
    &lt;%end%&gt;
  }
  </code></pre>
  
  <p>i am getting back </p>
  
  <pre><code>{
   data: #&lt;StringIO:0x1058a6cd0&gt;
  
  }
  </code></pre>
  
  <p>which is not the IMGdata im looking for
  looking for