Hi,

I have going through all the discussions looking for an easy way to
show a blob in a view. I have got to what I think is the most simple
way of doing it.

Controller:

  function display($id) {
    Configure::write('debug', 0);
    $file = $this->Image->findById($id);
    $type = $file['Image']['type'];
    $data = base64_decode($file['Image']['image']);
    header("Content-type: $type");
    echo "$data";
    exit();
  }

View:

echo '<img src="/images/display/'.$image['Image']['id'].'" title="'.
$image['Image']['name'].'" alt="'.$image['Image']['name'].'" />';

All I get in FF is the alt tag and in IE I get the gobligook.

Any thoughts?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to