Re: How to display a BLOB object in VIEW

2011-01-18 Thread pinastro
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




not getting how will i use  tag ???

Thanks
Karthik


On Jan 19, 9:37 am, Ryan Schmidt  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  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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


How to display a BLOB object in VIEW

2011-01-18 Thread pinastro
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


How ?


Thanks
Karthik

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


URGENT - Help needed - Model Association

2010-12-29 Thread pinastro
I have created a Blog Application using a base table as 'Posts'. Later
Model-Associated with another table 'Users' with 'belongsTo'
relationship like below in the MODEL

var $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);

But still I am not able to store the UserId in the Posts Table ???
What's the Problem

Plus what does the following lines of code mean :: I saw the
comments_controller.php which got generated using the BAKE command
when MODEL ASSOCIATED the 'Posts' table with the 'Comments' Table :

$posts = $this->Comment->Post->find('list');
$this->set(compact('posts'));


If not above ; is there anyway I can store the UserId in the Posts
Table using Model Associated cakePHP application ?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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