This is how I do it:

I use /pictures/download instead of /images/display but that should be
irrelevant.  You can make adjustments where necessary.

In my Pictures controller I have:

        function download($id)
        {
                $this->layout = 'image';
                $this->set('pictures', $this->Picture->read(null, $id));
        }

My download.thtml view looks like this:
<?php
header("Content-length:".$pictures['Picture']['filesize']);
header("Content-type: ".$pictures['Picture']['mime']);
header("Content-Disposition: attachment;
filename=".$pictures['Picture']['filename'].".".$pictures['Picture']['ext']);
echo $pictures['Picture']['content'];
?>

And lastly my image.thtml layout is a one liner that looks like this:
<?php echo $content_for_layout;?>

Once I got all that working, I can use the image in a view like this:
$html->image('/pictures/download/'.$picture['Pictures']['id'],array('alt'=>$picture['Pictures']['filename'])

Hope this helps.  If I need to clarify anything just let me know.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to