I have a table named 'IndustryLinks'. Each record in that table
corresponds to an image file of the company's logo. I store these
image files in a directory on the server's filesystem.
I have created (rather, I'm trying to create) a behavior class to
handle the action of thumbnailing these image files and storing the
results in a cache folder (APP/webroot/cache).
I know that I can pass parameters into behavior objects from the
model, but the thumbnails will need to be different sizes depending on
the page, so I will need to pass "box_width and "box_height"
parameters from the controller somehow. I was thinking about something
like this:
<?php
// APP/models/behaviors/thumbnail.php
class ThumbnailBehavior extends ModelBehavior {
function afterFind(&$Model, $primary) {
// Get box_width and box_height from the controller somehow
// Process the thumbs and store the cache paths in the results
}
}
?>
<?php
// APP/controllers/page_controller.php
// ...
$industry_links = ClassRegistry::init('IndustryLink')->find('all',
array(
'conditions' => array('IndustryLink.active <>' => '0'),
'thumbnail_parameters' => array(160, 160)
));
// ...
?>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---