Hi,

I have some very small thumbnails(16x16) saved in database. To be able
to get them out of the db and link them as sources for img's, I set up
a controller/action that retrieves the data and renders the view with
an image header.

This works fine, but it's a little bit too slow, I can watch them
loading one by one on the site, if there are like 20 this is no fun.
If I make an extra php and directly access and output the images
without cakephp controller/action, it is so much faster.

But I would really like to do it the cake way, so my question is, what
can I do to speed it up over controller/action? And if there is not
much I can do, how could I at least include the cakePHP database
connection into the extra php file?

Here is some Code how it looks like with controller/Action:

/* Website View */
<img width="16" height="16" src="albums/thumbnail/<?php echo
$data['Album']['id']; ?>" />

/* Thumbnail Action */
function thumbnail($id) {
  $data= $this->Cover->find('Album.id='.$id, 'thumbnail');
  $this->set('thumbnail', $data['Cover']['thumbnail']);
}

/* Thumbnail View */
header('Content-Type: image/jpeg');
echo $thumbnail;

And directly with cover.php:

/* Website View*/
echo $html->image('cover.php?id='.$data['Album']['id']);

/* Cover.php */
header('Content-Type: image/jpeg');
...
// database connection
...
$result = mysql_query('SELECT thumbnail FROM covers WHERE album_id='.
$_GET['id']);
$data = mysql_fetch_array($result);
echo $data['thumbnail'];

Thx in advance,

Michael
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to