protected function preparePartnerSlides() { $slides = array(); $data = Yii::app()->db->createCommand(sprintf('SELECT p.title, ph.filename, ph.title photo_title, ph.description photo_description FROM partners p LEFT JOIN gallery g ON g.`gallery_id` = p.gallery_id LEFT JOIN photo ph ON ph.gallery_id = g.gallery_id WHERE p.is_active = 1 AND p.partner_id <> %d AND (ph.is_top <> 1 OR ph.is_top IS NULL) ORDER BY ph.sort_order DESC', Yii::app()->params['partner_id']))->queryAll(); foreach ($data as $slide) { $slides[] = array('url' => ImageHelper::imageUrl('', $slide['filename']), 'content' => sprintf('<img src=\'%s\' alt\'%s\' title=\'%s\'></img>', ImageHelper::imageUrl('partner_footer_frontend', $slide['filename']), ContentHelper::prepareStr($slide['title']), ContentHelper::prepareStr($slide['title']))); } return $slides; }
protected function prepareSlides() { $slides = array(); $data = Yii::app()->db->createCommand('SELECT gp.*, p.title post_title, ph.filename, ph.title photo_title, ph.description photo_description, u.firstname, u.lastname FROM galleryposts gp LEFT JOIN users u ON u.user_id = gp.user_id LEFT JOIN posting p ON p.post_id = gp.post_id LEFT JOIN gallery g ON g.`gallery_id` = p.gallery_id LEFT JOIN photo ph ON ph.gallery_id = g.gallery_id WHERE gp.is_top = 1 AND gp.publication_date <= NOW() ORDER BY ph.sort_order DESC')->queryAll(); foreach ($data as $slide) { $slides[] = array('url' => ImageHelper::imageUrl('main_page_slider', $slide['filename']), 'content' => sprintf('<a href=\'%s\'><img src=\'%s\' alt=\'%s\' title=\'%s\'></img></a>', Yii::app()->createAbsoluteUrl('portfolio/default/view', array('id' => $slide['post_id'])), ImageHelper::imageUrl('main_page_slider', $slide['filename']), ContentHelper::prepareStr($slide['photo_description']), ContentHelper::prepareStr($slide['photo_description']))); } return $slides; }
<?php $imgUrl = ImageHelper::imageUrl('thumb_horoscope', $item['filename']); $arrOrder = explode('-', $signsOrder); ?> <div class="content-block"> <img width="91px" height="79px" src="<?php echo $imgUrl; ?> " alt=""> <div> <div class="block-title"><?php echo $item['title']; ?> </div> <span class="small"><?php echo '(' . $arrOrder[0] . ' — ' . $arrOrder[1] . ')'; ?> </span> <?php echo $item['content']; ?> </div> </div>
<div class="partner"> <img src="<?php echo $imgUrl = ImageHelper::imageUrl('partner_index_frontend', $this->getIndexFotoFile($data['gallery_id'])); ?> " alt=""/> <div> <h3><?php echo $data['title']; ?> </h3> <?php echo $data['description']; ?> <div class="small"> <?php echo $data['contacts']; ?> </div> </div> </div>
<ul class="album-list article-album"> <?php foreach ($data as $blogs) { ?> <?php $arr = explode(' ', $blogs['publication_date']); $timestamp = CDateTimeParser::parse($blogs['publication_date'], 'yyyy-MM-dd hh:mm:ss'); $date = Yii::app()->dateFormatter->format('d MMMM y', $timestamp); $title = ContentHelper::cutStringEx($blogs['p_title'], 100); $imgUrl = ImageHelper::imageUrl('blogs_slider', $blogs['filename']); ?> <li title="<?php echo $title; ?> "> <a href="<?php echo Yii::app()->createAbsoluteUrl('blogs/default/view', array('id' => $blogs['id'])); ?> "> <img style="width: 335px; height: 228px;" src="<?php echo $imgUrl; ?> " alt="<?php echo $title; ?> " title="<?php echo $title; ?> "> <span> <span class="album-title"><?php
<?php $month = mb_strtolower(Magazine::getMonthName($data['publication_month']), 'UTF-8'); $year = $data['publication_year']; $imgUrl = ImageHelper::imageUrl('magazine_title', $data['filename']); if (isset($data['magazine']) && !empty($data['magazine']) && file_exists(Yii::app()->params['uploadDir'] . $data['magazine'])) { $magazine = $data['magazine']; } else { $magazine = false; } echo "<img alt='" . $data['title'] . "' title='" . $data['title'] . "' src='" . $imgUrl . "'>"; ?> <p>журнал «Atmosphera»<br><?php echo "{$month}, {$year} г."; ?> </p> <a class="button" target="helperFrame" href="<?php if ($magazine) { echo Yii::app()->createAbsoluteUrl('blogs/default/downloadFile', array('filename' => $magazine)); } else { echo '#'; } ?> ">скачать</a> <iframe style="display: none;" name="helperFrame"></iframe>
echo $data['content']; ?> </div> <?php if ($data['is_active']) { ?> <ul class="photo-list"> <?php foreach ($photos as $photo) { ?> <?php $description = ContentHelper::cutStringEx($photo['description'], 100); $imgThumbUrl = ImageHelper::imageUrl('portfolio_index_frontend', $photo['filename']); $imgRawUrl = ImageHelper::imageUrl('raw', $photo['filename']); ?> <li> <a class="fancybox-button" rel="fancybox-button" href="<?php echo $imgRawUrl; ?> " title="<?php echo $description; ?> "> <img src="<?php echo $imgThumbUrl; ?> " alt="<?php echo $description; ?>
</div> <?php foreach ($newsData as $data) { $arr = explode(' ', $data['publication_date']); $date = Yii::app()->dateFormatter->formatDateTime(CDateTimeParser::parse($arr[0], 'yyyy-MM-dd'), 'long', null); ?> <div class="content-block"> <div class="title">Интересно</div> <a href="<?php echo Yii::app()->createAbsoluteUrl('blogs/view/id/' . $data['post_id']); ?> "> <img src="<?php echo ImageHelper::imageUrl('blogs_isTop_frontend', $data['photo']['filename']); ?> " alt="<?php echo ContentHelper::prepareStr($data['photo']['description']); ?> " title="<?php echo ContentHelper::prepareStr($data['photo']['description']); ?> "/> </a> <div> <h2><a href="<?php echo Yii::app()->createAbsoluteUrl('blogs/view/id/' . $data['post_id']); ?> "><?php echo $data['p_title'];
<?php $url = yii::app()->createAbsoluteUrl('portfolio/default/view/id/' . $data['post_id']); $anounce = $data['anounce']; $imgUrl = ImageHelper::imageUrl('portfolio_index_frontend', $data['filename']); $title = ContentHelper::cutStringEx($data['p_title'], 100); $timestamp = CDateTimeParser::parse($data['publication_date'], 'yyyy-MM-dd hh:mm:ss'); $date = Yii::app()->dateFormatter->format('d MMMM y', $timestamp); $author = $data['firstname'] . ' ' . $data['lastname']; ?> <li> <a href="<?php echo $url; ?> "> <img src="<?php echo $imgUrl; ?> " alt=""> <span> <span class="album-title"><?php echo $title; ?> </span> <p><?php echo $data['anounce']; ?> </p> <span class="album-date"><?php echo $author;
<?php $banerScript = ''; $i = 0; foreach ($data as $rowdata) { if ($rowdata['mime_type'] == 'image/jpeg') { echo '<a href="' . $rowdata['link'] . '" target="_blank"><img src="' . ImageHelper::imageUrl('banners_photo', $rowdata['filename']) . '" alt="' . $rowdata['title'] . '"/></a>'; // todo:file path } else { $i++; ?> <div id="banner<?php echo $i; ?> "> <p>Banner</p> </div> <?php $banerScript .= 'swfobject.embedSWF("' . Yii::app()->params['uploadUrl'] . 'files/' . $rowdata['filename'] . '", "banner' . $i . '", "272", "191", "9.0.0", false, {}, {wmode: "transparent"});'; } Yii::app()->clientScript->registerScript('bannerScript', $banerScript, CClientScript::POS_BEGIN); }
/** * testImage * * @expectedException \InvalidArgumentException * @return void */ public function testImageUrlInvalidArgumentException() { $image = array('id' => 'e479b480-f60b-11e1-a21f-0800200c9a66', 'model' => 'Test', 'path' => 'test/path/', 'extension' => 'jpg', 'adapter' => 'Local'); $this->Image->imageUrl($image, 'invalid-version!'); }