protected function getFileAsTag($attributes) { $fi = $this->getFileInfo(); $context = sfContext::getInstance(); $context->getConfiguration()->loadHelpers(array('majaxMedia'), $context->getModuleName()); if (!$fi) { return null; } if ($fi->isImage()) { $stuff = array(); $width = $this->getOption('width') !== null ? $this->getOption('width') : 600; $height = $this->getOption('height') !== null ? $this->getOption('height') : null; $ratio = '16:9'; $stuff['width'] = $width; $stuff['height'] = $height; $stuff['src'] = $this->getOption('file_src'); $stuff['alt'] = $fi->getName(); return majaxMedia($fi)->width($width); return $this->renderTag('img', array_merge($stuff, $attributes)); } if ($fi->isVideo()) { return majaxMedia($fi)->width(600); $context = sfContext::getInstance(); $context->getResponse()->addJavascript('/majaxDoctrineMediaPlugin/js/swfobject.js'); $id = $this->generateIdString('video_'); $cont = $this->getFlashRequiredBlock($id, 'video'); $width = $this->getOption('width') !== null ? $this->getOption('width') : $fi->getWidth(); $height = ($this->getOption('height') !== null ? $this->getOption('height') : $fi->getHeight()) + $this->getOption('controller_height'); $length = $this->getOption('length') !== null ? $this->getOption('length') : $fi->getLength(); $jscont = $this->getPlayerJSBlock($id, $this->getOption('file_src'), $width, $height, $length); $cont .= $this->renderContentTag('script', $jscont, array('type' => 'text/javascript')); return $cont; } if ($fi->isAudio()) { return majaxMedia($fi)->width(600); $context = sfContext::getInstance(); $context->getResponse()->addJavascript('/majaxDoctrineMediaPlugin/js/swfobject.js'); $id = $this->generateIdString('audio_'); $cont = $this->getFlashRequiredBlock($id, 'audio'); $width = $this->getOption('width') !== null ? $this->getOption('width') : 400; $height = ($this->getOption('height') !== null ? $this->getOption('height') : 0) + $this->getOption('controller_height'); $length = $this->getOption('length') !== null ? $this->getOption('length') : $fi->getLength(); $jscont = $this->getPlayerJSBlock($id, $this->getOption('file_src'), $width, $height, $length); $cont .= $this->renderContentTag('script', $jscont, array('type' => 'text/javascript')); return $cont; } $n = $fi->getName() . ' (' . $fi->getSizeFormatted() . ')'; return $this->renderContentTag('a', $n, array_merge(array('href' => $this->getOption('file_src')), $attributes)); }
?> <item> <pubDate><?php echo date('r', strtotime($gi_obj->updated_at)); ?> </pubDate> <description><?php echo strip_tags($gi_obj->getContentHtml(ESC_RAW)); ?> </description> <title><?php echo $gi_obj->name; ?> </title> <?php $media = majaxMedia($gallery_item); $media->width($width); $media->height($height); $media->crop_method($crop_method); $media->aspect_ratio($aspect_ratio); if ($media->getType() == 'Photo') { ?> <media:content url="<?php echo $media->photoToString(true, true); ?> " type="<?php echo $media->getPhotoMime(); ?> " duration="5" /> <media:thumbnail url="<?php echo $media->photoToString(true, true);
function updatePositionsCallback(res) { // not needed } </script> <ul class="sort_list" id="photo-list"> <?php use_helper('majaxMedia'); foreach ($gallery->Media as $media) { ?> <li class="photo" id="photo_<?php echo $media->id; ?> "> <?php $m = majaxMedia($media)->width(220)->aspect_ratio('16:9')->crop_method('center'); ?> <span class="image"><?php echo $m; ?> <span class="name"><span title="<?php echo $m->getName(); ?> "><?php echo majaxMediaToolbox::truncate($m->getName(), 30); ?> </span> <small><?php echo $m->getFormattedSize(); ?> </small></span> </li>