public function setScreenshots($screens, $deletePrior = true) { if ($deletePrior) { $c = new Criteria(); $c->add(PluginScreenshotPeer::PLUGIN_ID, $this->getId()); $c->add(PluginScreenshotPeer::PRIMARY, false); PluginScreenshotPeer::doDelete($c); } foreach ($screens as $url => $alt) { if ($url) { $s = new PluginScreenshot(); $s->setPlugin($this); $s->setUrl($url); $s->setTitle($alt); $s->save(); } } }
function thumbnail_image_tag(PluginScreenshot $object) { $path = basename(sfConfig::get('sf_upload_dir')) . '/' . sfConfig::get('app_screenshots_path') . '/' . $object->getPluginId() . '/' . $object->getId(); return image_tag('/' . $path . '/thumbs/' . $object->getFilename()); }