public function configure() { sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Thumb')); $this->widgetSchema['asso_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema['start_date'] = new sfWidgetDatePicker(); $this->validatorSchema['start_date'] = new sfValidatorDatePicker(array()); $this->widgetSchema['end_date'] = new sfWidgetDatePicker(); $this->validatorSchema['end_date'] = new sfValidatorDatePicker(array()); $this->widgetSchema['affiche'] = new sfWidgetFormInputFileEditable(array('file_src' => doThumb($this->getObject()->getAffiche(), 'events', array('width' => 150, 'height' => 150), 'scale'), 'is_image' => true, 'edit_mode' => !$this->isNew() && $this->getObject()->getAffiche(), 'with_delete' => true, 'delete_label' => "Supprimer cette illustration")); $this->validatorSchema['affiche'] = new sfValidatorFileImage(array('required' => false, 'path' => sfConfig::get('sf_upload_dir') . '/events/source', 'mime_types' => 'web_images', 'max_width' => 1000, 'max_height' => 1000)); $this->widgetSchema['guest_asso_list']->setOption('method', 'getName'); $this->widgetSchema->setLabel('guest_asso_list', 'Associations Partenaires'); $this->widgetSchema['guest_asso_list']->setAttributes(array('style' => 'width:100%;', 'class' => 'select2')); $this->validatorSchema['affiche_delete'] = new sfValidatorBoolean(); $this->widgetSchema->setLabel('name', 'Nom'); $this->widgetSchema->setLabel('type_id', 'Type'); $this->widgetSchema->setLabel('start_date', 'Début'); $this->widgetSchema->setLabel('end_date', 'Fin'); $this->widgetSchema->setLabel('summary', 'Résumé en une ligne'); $this->widgetSchema->setLabel('description', 'Description'); $this->widgetSchema->setLabel('place', 'Lieu'); $this->widgetSchema->setLabel('is_public', 'Ouvert au public ?'); $this->widgetSchema->setLabel('affiche', 'Illustration'); $this->widgetSchema->setLabel('is_weekmail', 'Paraître dans le Weekmail ?'); $this->widgetSchema['is_weekmail']->setAttribute('style', 'width: 15px;'); $this->useFields(array('asso_id', 'name', 'type_id', 'start_date', 'end_date', 'summary', 'description', 'place', 'is_public', 'affiche', 'is_weekmail', 'guest_asso_list')); }
public function configure() { sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Thumb')); unset($this['created_at'], $this['updated_at']); $this->widgetSchema['logo'] = new sfWidgetFormInputFileEditable(array('file_src' => doThumb($this->getObject()->getLogo(), 'partenaires', array('width' => 150, 'height' => 150), 'scale'), 'is_image' => true, 'edit_mode' => !$this->isNew() && $this->getObject()->getLogo(), 'with_delete' => true, 'delete_label' => "Supprimer ce logo")); $this->validatorSchema['logo'] = new sfValidatorFileImage(array('required' => false, 'path' => sfConfig::get('sf_upload_dir') . '/partenaires/source', 'mime_types' => 'web_images', 'max_width' => 1000, 'max_height' => 1000)); $this->validatorSchema['logo_delete'] = new sfValidatorBoolean(); }
public function executeShow(sfWebRequest $request) { $this->article = $this->getRoute()->getObject(); $response = $this->getResponse(); $response->addMeta('og:title', $this->article->getName()); $response->addMeta('og:type', 'Article'); sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Thumb')); $response->addMeta('og:image', doThumb($this->article->getImage(), 'articles', array('width' => 150, 'height' => 150), 'scale')); $response->addMeta('og:url', $this->generateUrl('article_show', $this->article, true)); $response->addMeta('og:site_name', 'BDE-UTC : Portail des associations'); }
public function configure() { sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Thumb')); $this->disableLocalCSRFProtection(); $this->setWidgets(array('id' => new sfWidgetFormInputHidden(), 'galeriePhoto_id' => new sfWidgetFormInputHidden(), 'title' => new sfWidgetFormInputHidden(), 'author' => new sfWidgetFormInputHidden(), 'is_public' => new sfWidgetFormInputCheckbox(array('default' => false)))); $this->widgetSchema['image'] = new sfWidgetFormInputFileEditable(array('file_src' => doThumb($this->getObject()->getImage(), 'galeries', array('width' => 150, 'height' => 150), 'scale'), 'is_image' => true, 'edit_mode' => !$this->isNew() && $this->getObject()->getImage(), 'with_delete' => true, 'delete_label' => "Supprimer cette photo")); $this->setValidators(array('id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)), 'galeriePhoto_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('GaleriePhoto'))), 'title' => new sfValidatorString(array('max_length' => 200, 'required' => false)), 'author' => new sfValidatorInteger(), 'is_public' => new sfValidatorBoolean())); $this->validatorSchema['image'] = new sfValidatorFileImage(array('required' => false, 'path' => sfConfig::get('sf_upload_dir') . '/galeries/source', 'mime_types' => 'web_images', 'max_width' => 2048, 'max_height' => 2048)); $this->widgetSchema->setLabel('title', 'Titre'); $this->widgetSchema->setLabel('author', 'Photographe'); $this->widgetSchema->setLabel('is_public', "Est publique"); $this->widgetSchema->setNameFormat('photo[%s]'); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); $this->useFields(array('galeriePhoto_id', 'title', 'author', 'is_public', 'image')); }
public function configure() { sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Thumb')); $this->widgetSchema['asso_id'] = new sfWidgetFormInputHidden(); $this->widgetSchema['image'] = new sfWidgetFormInputFileEditable(array('file_src' => doThumb($this->getObject()->getImage(), 'articles', array('width' => 150, 'height' => 150), 'scale'), 'is_image' => true, 'edit_mode' => !$this->isNew() && $this->getObject()->getImage(), 'with_delete' => true, 'delete_label' => "Supprimer cette illustration")); $this->widgetSchema['text'] = new sfWidgetFormTextarea(array(), array('rows' => '20')); $this->widgetSchema['summary'] = new sfWidgetFormTextarea(array(), array('rows' => '5')); $this->validatorSchema['image'] = new sfValidatorFileImage(array('required' => false, 'path' => sfConfig::get('sf_upload_dir') . '/articles/source', 'mime_types' => 'web_images', 'max_width' => 1000, 'max_height' => 1000)); $this->validatorSchema['image_delete'] = new sfValidatorBoolean(); $this->widgetSchema->setLabel('name', 'Titre'); $this->widgetSchema->setLabel('text', 'Contenu'); $this->widgetSchema->setLabel('image', 'Illustration'); $this->widgetSchema->setLabel('is_weekmail', 'Paraître dans le Weekmail ?'); $this->widgetSchema['is_weekmail']->setAttribute('style', 'width: 15px;'); $this->widgetSchema->setLabel('summary', 'Résumé pour le Weekmail'); $this->useFields(array('asso_id', 'name', 'text', 'image', 'is_weekmail', 'summary')); }
public function configure() { sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Thumb')); unset($this->widgetSchema['created_at'], $this->widgetSchema['updated_at'], $this->validatorSchema['created_at'], $this->validatorSchema['updated_at']); $this->widgetSchema['logo'] = new sfWidgetFormInputFileEditable(array('file_src' => doThumb($this->getObject()->getLogo(), 'assos', array('width' => 150, 'height' => 150), 'scale'), 'is_image' => true, 'edit_mode' => !$this->isNew() && $this->getObject()->getLogo(), 'with_delete' => true, 'delete_label' => "Supprimer ce logo")); $this->validatorSchema['logo'] = new sfValidatorFileImage(array('required' => false, 'path' => sfConfig::get('sf_upload_dir') . '/assos/source', 'mime_types' => 'web_images', 'max_width' => 1000, 'max_height' => 1000)); $this->validatorSchema['logo_delete'] = new sfValidatorBoolean(); $this->widgetSchema->setLabel('name', 'Nom'); $this->widgetSchema->setLabel('pole_id', 'Pôle'); $this->widgetSchema->setLabel('type_id', 'Structure'); $this->widgetSchema->setLabel('summary', "L'asso en une ligne"); $this->widgetSchema->setLabel('salle', 'Local'); $this->widgetSchema->setLabel('phone', 'Téléphone'); $this->widgetSchema->setLabel('facebook', 'Page Facebook'); $this->widgetSchema->setLabel('joignable', 'Joignable'); $this->getWidget('pole_id')->setOption('query', PoleTable::getInstance()->getAllWithInfos()); }
/** * Cette function utilise la précédente afin d'afficher directement l'image avec les balises et les options. * @param <string> $image_name : le nom de l’image donc généralement le $object->getImage(), pas de répertoire * @param <string> $folder : le nom du répertoire dans "uploads" où est stocké l’image * @param <array> $options : les options contenus dans un array() : la taille de l’image (width et height) + la classe, l'id, le alt ... de l'image * @param <string> $resize : "scale" pour garder les proportions (deformation de l'image) OU "center" pour tronquer l’image sans la deformer) * @param <string> $default : l’image par défaut si $image_name n’existe pas * @return <image_path> */ function showThumb($image_name, $folder, $options = array(), $resize = 'center', $default = 'default.jpg') { if (empty($options['alt'])) { $options['alt'] = 'image ' . $image_name; } $image_path = doThumb($image_name, $folder, $options, $resize, $default); $img = new sfImage(sfConfig::get('sf_web_dir') . $image_path); //récupere les vraies dimensions de l'image du thumb et on écrase dans les options. $options['width'] = $img->getWidth(); $options['height'] = $img->getHeight(); return image_tag($image_path, $options); }
public function executeShow(sfWebRequest $request) { $this->event = $this->getRoute()->getObject(); $response = $this->getResponse(); $response->addMeta('og:title', $this->event->getName()); $response->addMeta('og:type', 'Event'); sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Thumb')); $response->addMeta('og:image', doThumb($this->event->getAffiche(), 'events', array('width' => 150, 'height' => 150), 'scale')); $response->addMeta('og:url', $this->generateUrl('event_show', $this->event, true)); $response->addMeta('og:site_name', 'BDE-UTC : Portail des associations'); $this->participants = EventMemberTable::getInstance()->getParticipants($this->event)->execute(); $this->isPhotographer = $this->event->userIsPhotographer($this->getUser()); if ($this->getUser()->isAuthenticated()) { $r = EventMemberTable::getInstance()->getEventMember($this->event->getId(), $this->getUser()->getGuardUser()->getId())->execute(); $this->jeparticipe = false; if ($r->count() > 0) { $this->jeparticipe = true; } } $this->galeries = $this->event->getGaleries()->execute(); }
<?php if (!isset($error)) { // Generate thumb (helpfull for big uploads) doThumb($photo->getImage(), 'galeries', array('width' => sfConfig::get('app_portail_photos_big_res_x'), 'height' => sfConfig::get('app_portail_photos_big_res_y')), 'scale'); doThumb($photo->getImage(), 'galeries', array('width' => sfConfig::get('app_portail_photos_thumb_res_x'), 'height' => sfConfig::get('app_portail_photos_thumb_res_y')), 'center'); $result = array("success" => true); } else { $result = array("error" => $sf_data->get('error', ESC_RAW)); } echo json_encode($result);
public function executeLogo(sfWebRequest $request) { sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Thumb')); $width = intval($request->getParameter('width')); if ($width == 0) { $width = 150; } $height = intval($request->getParameter('height')); if ($height == 0) { $height = 150; } $asso = $this->getRoute()->getObject(); $this->redirect(doThumb($asso->getLogo(), 'assos', array('width' => $width, 'height' => $height), 'scale')); }
</div> <?php } ?> </div> </div> <div class="eight columns omega"> <div class="header-advert camera_ads_4" id="camera_wrap_4"> <?php foreach ($ads['2']['blogAds'] as $adv) { ?> <?php $data_src = doThumb($adv['image_rectangle'], 'ads', $options = array('width' => '468', 'height' => '60'), $resize = 'center', $default = 'default_illustration_ads.jpg'); ?> <?php if ($adv['direct_url']) { $data_link = $adv['direct_url']; } else { $data_link = url_for('partner_show', array('slug' => $adv['Partners']['slug'], 'sf_format' => 'html')); } ?> <div data-link="<?php echo $data_link; ?> " data-src="<?php
" <?php if ($photo->userIsPhotographer($user)) { echo 'data-edit-link="' . url_for('photo/edit?id=' . $photo->getId()) . '"'; } ?> data-permalink="<?php echo url_for('galerie/show?id=' . $photo->getGaleriePhoto()->getId() . '&photo=' . $photo->getId() . '&pass='******'galeries', array('width' => sfConfig::get('app_portail_photos_big_res_x'), 'height' => sfConfig::get('app_portail_photos_big_res_y')), 'scale'); ?> "> <?php include_partial('photo/photoThumbnail', array('photo' => $photo)); ?> </a> </li> <?php } ?> </ul> </div> <div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls blueimp-gallery-fullscreen"> <div class="slides"></div>
<div class="super-container full-width" id="section-slider"> <div class="container background"> <!-- <div class="sixteen columns" id="page-header"><br class="clear" /><hr /></div> --> <div class="sixteen columns slider-shadow"> <div class="camera_wrap camera_magenta_skin" id="camera_wrap_1"> <?php foreach ($articles as $article) { ?> <?php $data_thumb = doThumb($article['on_slider_image'], 'articles', $options = array('width' => '94', 'height' => '25'), $resize = 'center', $default = 'default_illustration_slider_article_thumb.png'); ?> <?php $data_src = doThumb($article['on_slider_image'], 'articles', $options = array('width' => '940', 'height' => '250'), $resize = 'center', $default = 'default_illustration_slider_article.png'); ?> <div data-link="<?php echo url_for('article_show', array('day' => format_date($article['created_at'], 'dd'), 'month' => format_date($article['created_at'], 'MM'), 'year' => format_date($article['created_at'], 'yyyy'), 'slug' => $article['slug'], 'sf_format' => 'html')); ?> " data-thumb="<?php echo $data_thumb; ?> " data-src="<?php echo $data_src; ?> "> <div class="camera_caption fadeFromBottom"> <?php