exactly , I am reading about Downloading the image ..

and somehow I am able to display the image too...but it's RAW image
CONTROLLER :::

function download($id) {
                Configure::write('debug', 0);
                $file = $this->MyFile->findById($id);
                $type= $file['MyFile']['type'];
                $length = $file['MyFile']['size'];
                $nam = $file['MyFile']['name'];

                header('Content-type: $type');
                header('Content-length: $length'); // some people reported 
problems
with this line (see the comments), commenting out this line helped in
those cases
                header('Content-Disposition: attachment; filename=$nam');
                echo $file['MyFile']['data'];   ///WHEN I COMMENT THIS LINE ....
ONLY FILE LOCATION (database) is PRINTED

                //$this->set(compact('file','nam'));
                exit();
}

VIEW

<?php
echo "DISPLAY PINASTRO";
header("Content-type: image/jpg");
echo print_r((explode("/",$data['MyFile']['data'])));  //THIS WAS FOR
TESTING PURPOSE THOUGH
?>


not getting how will i use <IMG> tag ???

Thanks
Karthik


On Jan 19, 9:37 am, Ryan Schmidt <[email protected]> wrote:
> On Jan 18, 2011, at 22:35, pinastro wrote:
>
> > I know there is already lot of text on this but most of them are like
> > DOWNLOADING content from the BLOB object which is working perfectly
> > but I want to display inside an image box in the VIEW
>
> I would imagine your controller will need a separate action that only 
> displays the image (perhaps using those techniques you read about for 
> downloading the contents of a blob). Then, in your main view, where you want 
> to display the image, you'll output an <img> tag whose href attribute is the 
> URL of that other action.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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