当前位置: 首页>>代码示例>>PHP>>正文


PHP image_path函数代码示例

本文整理汇总了PHP中image_path函数的典型用法代码示例。如果您正苦于以下问题:PHP image_path函数的具体用法?PHP image_path怎么用?PHP image_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了image_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: thumbnail_path

/**
 * Get the path of a generated thumbnail for any given image
 *
 * @param string $source
 * @param int $width
 * @param int $height
 * @param boolean $absolute
 * @return string
 */
function thumbnail_path($source, $width, $height, $absolute = false)
{
    $thumbnails_dir = sfConfig::get('app_sfThumbnail_thumbnails_dir', 'uploads/thumbnails');
    $width = intval($width);
    $height = intval($height);
    if (substr($source, 0, 1) == '/') {
        $realpath = sfConfig::get('sf_web_dir') . $source;
    } else {
        $realpath = sfConfig::get('sf_web_dir') . '/images/' . $source;
    }
    $real_dir = dirname($realpath);
    $thumb_dir = '/' . $thumbnails_dir . substr($real_dir, strlen(sfConfig::get('sf_web_dir')));
    $thumb_name = preg_replace('/^(.*?)(\\..+)?$/', '$1_' . $width . 'x' . $height . '$2', basename($source));
    $img_from = $realpath;
    $thumb = $thumb_dir . '/' . $thumb_name;
    $img_to = sfConfig::get('sf_web_dir') . $thumb;
    if (!is_dir(dirname($img_to))) {
        if (!mkdir(dirname($img_to), 0777, true)) {
            throw new Exception('Cannot create directory for thumbnail : ' . $img_to);
        }
    }
    if (!is_file($img_to) || filemtime($img_from) > filemtime($img_to)) {
        $thumbnail = new sfThumbnail($width, $height);
        $thumbnail->loadFile($img_from);
        $thumbnail->save($img_to);
    }
    return image_path($thumb, $absolute);
}
开发者ID:net7,项目名称:Talia-CMS,代码行数:37,代码来源:sfThumbnailHelper.php

示例2: doThumb

/**
 * g?n?rer le thumb correspondant ? une image.
 * cete fonction v?rifie si le thumb existe d?j? ou si la source est plus r?cente
 * si besoin, il est reg?n?r?.
 * il faut faire passer en parametres options[width] et options[height]
 * et l'image est automatiquement redimensionner en thumb.
 * si width = height alors l'image sera tronqu�e et carr�
 *
 * @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 : uploads/object/source => $folder = object
 * @param <array> $options : les parametres ? passer ? l'image: width et height
 * @param <string> $resize : l'op?ration sur le thumb: "scale" pour garder les proportions, "center" pour tronquer l'image
 * @param <string> $default : l'image par d?faut si image_name n'existe pas
 * @return <image_path>
 */
function doThumb($image_name, $folder, $options = array(), $resize = 'scale', $default = 'default.jpg')
{
    //valeur par d�faut si elles ne sont pas d�finies
    if (!isset($options['width'])) {
        $options['width'] = 50;
    }
    if (!isset($options['height'])) {
        $options['height'] = 50;
    }
    /*$source_dir = 'uploads/'.$folder.'/source/';
      $thumb_dir  = 'uploads/'.$folder.'/thumb/';*/
    $source_dir = 'uploads/' . $folder . '/';
    $thumb_dir = 'uploads/' . $folder . '/thumb/';
    //le fichier source
    $source = $source_dir . $image_name;
    $exist = sfConfig::get('sf_web_dir') . '/' . $source;
    if (!is_file($exist)) {
        $image_name = $default;
        $source = 'images/' . $image_name;
        // la valeur par d�faut
    }
    $new_name = $options['width'] . 'x' . $options['height'] . '_' . $image_name;
    $new_img = $thumb_dir . $new_name;
    // si le thumb n'existe pas ou s'il est plus ancien que le fichier source
    // alors on reg�n�re le thumb
    if (!is_file(sfConfig::get('sf_web_dir') . '/' . $new_img) or filemtime($source) > filemtime($new_img)) {
        $img = new sfImage($source);
        $img->thumbnail($options['width'], $options['height'], $resize)->saveAs($new_img);
    }
    return image_path('/' . $new_img);
}
开发者ID:ndachez,项目名称:dachez,代码行数:46,代码来源:ThumbHelper.php

示例3: image_zap

function image_zap($image_id)
{
    $filename = db_getOne("SELECT filename FROM image WHERE id=?", $image_id);
    db_do("DELETE FROM image WHERE id=?", $image_id);
    db_commit();
    unlink(image_path($filename));
}
开发者ID:bcampbell,项目名称:journalisted,代码行数:7,代码来源:image.php

示例4: lw_image

function lw_image($name = '', $image_path = '', $options = array())
{
    if (strpos($image_path, '://') === false) {
        return lw_link($name, image_path($image_path, true), $options);
    } else {
        return lw_link($name, $image_path, $options);
    }
}
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:8,代码来源:LightWindowHelper.php

示例5: show

 public function show($hash, $time, $small = false)
 {
     $image = Image::where('hash', '=', $hash)->where('uploaded_at', '=', Carbon::createFromTimestamp($time))->first();
     if (null === $image) {
         throw new NotFoundHttpException();
     }
     return $this->imageResponse(image_path($hash, $time, $small), $image->getAttribute('mime_type'));
 }
开发者ID:BePsvPT,项目名称:CCU,代码行数:8,代码来源:ImagesController.php

示例6: deleteOldProfilePicture

 /**
  * Delete the profile picture.
  *
  * @param $id
  */
 protected function deleteOldProfilePicture($id)
 {
     $image = Image::find($id);
     if (null !== $image) {
         unlink(image_path($image->getAttribute('hash'), $image->getAttribute('uploaded_at')->timestamp));
         unlink(image_path($image->getAttribute('hash'), $image->getAttribute('uploaded_at')->timestamp, true));
         $image->delete();
     }
 }
开发者ID:BePsvPT,项目名称:CCU,代码行数:14,代码来源:Avatar.php

示例7: process_comment_items

/**
 * Function to process the items in an X amount of comments
 * 
 * @param array $comments The comments to process
 * @return array
 */
function process_comment_items($comments)
{
    $ci =& get_instance();
    foreach ($comments as &$comment) {
        // work out who did the commenting
        if ($comment->user_id > 0) {
            $comment->name = anchor('admin/users/edit/' . $comment->user_id, $comment->name);
        }
        // What did they comment on
        switch ($comment->module) {
            case 'pages':
                if ($page = $ci->pages_m->get($comment->module_id)) {
                    $comment->item = anchor('admin/pages/preview/' . $page->id, $page->title, 'class="modal-large"');
                    break;
                }
            case 'news':
                if (!module_exists('news')) {
                    break;
                }
                $ci->load->model('news/news_m');
                if ($article = $ci->news_m->get($comment->module_id)) {
                    $comment->item = anchor('admin/news/preview/' . $article->id, $article->title, 'class="modal-large"');
                    break;
                }
            case 'photos':
                if (!module_exists('photos')) {
                    break;
                }
                $ci->load->model('photos/photos_m');
                $ci->load->model('photos/photo_albums_m');
                $photo = $ci->photos_m->get($comment->module_id);
                if ($photo && ($album = $ci->photo_albums_m->get($photo->album_id))) {
                    $comment->item = anchor(image_path('photos/' . $album->id . '/' . $photo->filename), $photo->caption, 'class="modal"');
                    break;
                }
            case 'photos-album':
                if (!module_exists('photos')) {
                    break;
                }
                $ci->load->model('photos/photo_albums_m');
                if ($album = $ci->photo_albums_m->get($comment->module_id)) {
                    $comment->item = anchor('photos/' . $album->slug, $album->title, 'class="modal-large iframe"');
                    break;
                }
            default:
                $comment->item = $comment->module . ' #' . $comment->module_id;
                break;
        }
        // Link to the comment
        if (strlen($comment->comment) > 30) {
            $comment->comment = character_limiter($comment->comment, 30);
        }
    }
    return $comments;
}
开发者ID:8496tar,项目名称:pyrocms,代码行数:61,代码来源:comments_helper.php

示例8: executeGet_images

 public function executeGet_images(sfWebRequest $request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Asset');
     $this->getResponse()->setContentType('application/json');
     $lUrl = $request->getParameter("url");
     $lImages = ImageParser::fetch($lUrl);
     $lImages[] = image_path("/img/share/default.png", true);
     $lReturn['count'] = count($lImages);
     $lReturn['html'] = $this->getPartial('like/meta_images_list', array('pImages' => $lImages));
     return $this->renderText(json_encode($lReturn));
 }
开发者ID:42medien,项目名称:spreadly,代码行数:11,代码来源:actions.class.php

示例9: configure

 public function configure()
 {
     $startYear = sfConfig::get('app_year_range_start', date('Y') - 5);
     $years = range($startYear, date('Y') + 5);
     $sfWidgetFormI18nJQueryDateOptions = array('culture' => $this->getOption('culture', 'en'), 'image' => image_path('icons/calendar.png'), 'config' => "{ duration: '' }", 'years' => array_combine($years, $years));
     $this->setWidgets(array('query' => new sfWidgetFormInputText(), 'from' => new sfWidgetFormI18nJQueryDate($sfWidgetFormI18nJQueryDateOptions), 'to' => new sfWidgetFormI18nJQueryDate($sfWidgetFormI18nJQueryDateOptions), 'quick_dates' => new sfWidgetFormChoice(array('choices' => InvoiceSearchForm::getQuickDates()))));
     $this->widgetSchema->setLabels(array('query' => 'Search', 'from' => 'from', 'to' => 'to', 'quick_dates' => ' '));
     $dateRangeValidatorOptions = array('required' => false);
     $this->setValidators(array('query' => new sfValidatorString(array('required' => false, 'trim' => true)), 'from' => new sfValidatorDate($dateRangeValidatorOptions), 'to' => new sfValidatorDate($dateRangeValidatorOptions)));
     $this->widgetSchema->setNameFormat('search[%s]');
     $this->widgetSchema->setFormFormatterName('list');
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:12,代码来源:CustomerSearchForm.class.php

示例10: formatter

 public function formatter($widget, $inputs)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Asset');
     $rows = array();
     foreach ($inputs as $key => $input) {
         $image_option = array('src' => image_path($this->getOption('image_prefix') . $key), 'alt' => $this->getOption('image_prefix') . $key);
         $image = $this->renderTag('img', $image_option);
         $list = $this->renderContentTag('dt', $image) . $this->renderContentTag('dd', $input['input'] . $this->getOption('label_separator') . $input['label']);
         $rows[] = $this->renderContentTag('dl', $list);
     }
     return $this->renderContentTag('div', implode($this->getOption('separator'), $rows), array('class' => $this->getOption('class')));
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:12,代码来源:sfWidgetFormSelectPhotoRadio.class.php

示例11: image_tag

function image_tag($filename, $options = array())
{
    $options['src'] = image_path($filename);
    if (!isset($options['alt'])) {
        list($alt, ) = explode('.', basename($options['src']));
        $options['alt'] = ucfirst($alt);
    }
    if (isset($options['size'])) {
        list($options['width'], $options['height']) = explode('x', $options['size']);
        unset($options['size']);
    }
    return tag('img', $options);
}
开发者ID:BackupTheBerlios,项目名称:stato-svn,代码行数:13,代码来源:asset_tag_helper.php

示例12: configure

 public function configure()
 {
     $startYear = sfConfig::get('app_year_range_start', date('Y') - 5);
     $years = range($startYear, date('Y') + 5);
     $sfWidgetFormI18nJQueryDateOptions = array('culture' => $this->getOption('culture', 'en'), 'image' => image_path('icons/calendar.png'), 'config' => "{ duration: '' }", 'years' => array_combine($years, $years));
     $this->setWidgets(array('query' => new sfWidgetFormInputText(), 'from' => new sfWidgetFormI18nJQueryDate($sfWidgetFormI18nJQueryDateOptions), 'to' => new sfWidgetFormI18nJQueryDate($sfWidgetFormI18nJQueryDateOptions), 'quick_dates' => new sfWidgetFormChoice(array('choices' => InvoiceSearchForm::getQuickDates())), 'series_id' => new sfWidgetFormChoice(array('choices' => array('' => '') + SeriesTable::getChoicesForSelect(false))), 'customer_id' => new sfWidgetFormChoice(array('choices' => array())), 'tags' => new sfWidgetFormInputHidden(), 'status' => new sfWidgetFormInputHidden(), 'sent' => new sfWidgetFormChoice(array('choices' => array('' => '', 1 => 'yes', 0 => 'no')))));
     $this->widgetSchema->setLabels(array('query' => 'Search', 'from' => 'from', 'to' => 'to', 'quick_dates' => ' ', 'series_id' => 'Series', 'customer_id' => 'Customer', 'sent' => 'Sent'));
     $dateRangeValidatorOptions = array('required' => false);
     $this->setValidators(array('query' => new sfValidatorString(array('required' => false, 'trim' => true)), 'from' => new sfValidatorDate($dateRangeValidatorOptions), 'to' => new sfValidatorDate($dateRangeValidatorOptions), 'customer_id' => new sfValidatorString(array('required' => false, 'trim' => true)), 'tags' => new sfValidatorString(array('required' => false, 'trim' => true)), 'status' => new sfValidatorString(array('required' => false, 'trim' => true))));
     // autocomplete for customer
     $this->widgetSchema['customer_id']->setOption('renderer_class', 'sfWidgetFormJQueryAutocompleter');
     $this->widgetSchema['customer_id']->setOption('renderer_options', array('url' => url_for('search/ajaxCustomerAutocomplete'), 'value_callback' => 'CustomerTable::getCustomerName'));
     $this->widgetSchema->setNameFormat('search[%s]');
     $this->widgetSchema->setFormFormatterName('list');
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:15,代码来源:InvoiceSearchForm.class.php

示例13: light_image

/**
 * Returns an image link to use the lightbox function for 1 image.
 *
 * @param string $thumbnail Name of thumbnail to display
 * @param string $image     Name of full size image to display
 * @param array  $options   Options of the link
 * 
 * @author COil
 * @since 1.0.0 - 5 feb 07
 */
function light_image($link_content, $image, $link_options = array(), $image_options = array(), $li = false, $link_type = 'IMAGE')
{
    _addLbRessources();
    $link_options = _parse_attributes($link_options);
    $image_options = _parse_attributes($image_options);
    // Lightbox specific
    $link_options['rel'] = isset($link_options['rel']) ? $link_options['rel'] : 'lightbox';
    // Resources type
    switch ($link_type) {
        case 'IMAGE':
            $link_content = image_tag($link_content, $image_options);
            break;
    }
    return ($li ? '<li>' : '') . link_to($link_content, image_path($image, true), $link_options) . ($li ? '</li>' : '');
}
开发者ID:net7,项目名称:Talia-CMS,代码行数:25,代码来源:LightboxHelper.php

示例14: renderAsTooltip

    /**
     * Render the changelog for $object (if any) as a tooltip.
     * This method can't be called directly, instead use self::render().
     *
     * @see render()
     *
     * @param  mixed $object Any object using ncPropelChangeLogBehavior.
     *
     * @return string
     */
    protected static function renderAsTooltip($object)
    {
        sfContext::getInstance()->getResponse()->addJavascript('changelog');
        self::loadHelpers('Asset');
        $klass = get_class($object);
        $id = $object->getId();
        $html_id = "changelog_for_{$klass}_{$id}";
        $html = <<<HTML
<a href="#" style="display: inline-block; margin: 1px;" onclick="changelog_render_tooltip('%url%','%klass%','%id%','#%html_id%'); return false;">
  <img style="vertical-align: middle;" src="%img_src%" alt="%img_alt%" title="%img_title%" />
</a>
<div id="%html_id%" class="nc_changelog_tooltip" style="display: none;"></div>
HTML;
        return strtr($html, array('%klass%' => $klass, '%url%' => url_for('@changelog_helper'), '%id%' => $id, '%html_id%' => $html_id, '%img_src%' => image_path('clock.png'), '%img_alt%' => __('Change log', array(), 'nc_change_log_behavior'), '%img_title%' => __('See change log', array(), 'nc_change_log_behavior')));
    }
开发者ID:nvidela,项目名称:kimkelen,代码行数:25,代码来源:ncChangelogRenderer.class.php

示例15: get_website_data

/**
 * list of websites to display on the showcase
 */
function get_website_data()
{
    /**
     * properties:
     * url = url for website to showcase
     * name = website name
     * theme = name of theme being used on that site
     * featured = if the site will display on the featured toggle. Remove property if not true
     * image = fallback image in case auto screenshot doesn't work for whatever reason. Image should be 400 x 300
     */
    /**
       '' => array(
           'url' => '',
           'name' => '',
           'theme' => 'themeslug',
           'tags' => array( 'themeslug', 'featured' ),
           'image' => '',
       ),
    */
    $websites = array('absurdisan' => array('url' => 'http://absurdisan.com/', 'name' => 'Absudisan', 'theme' => 'romero', 'tags' => array('featured')), 'ahoboawake' => array('url' => 'https://ahoboawake.com/', 'name' => 'Ahoboawake', 'theme' => 'broadsheet', 'tags' => array('featured')), 'latteluxury' => array('url' => 'https://latteluxurynews.com/', 'name' => 'Latte Lixiry News', 'theme' => 'broadsheet'), 'tanboy' => array('url' => 'https://prialterno.wordpress.com/', 'name' => 'Tan Boy', 'theme' => 'broadsheet', 'tags' => array('featured')), 'lockelandspringsteen' => array('url' => 'https://lockelandspringsteen.com/', 'name' => 'Lokeland Springsteen', 'theme' => 'broadsheet'), 'ahoboawake' => array('url' => 'https://ahoboawake.com/', 'name' => 'Ahoboawake', 'theme' => 'broadsheet'), 'aosugo' => array('url' => 'http://aosugo.com/', 'name' => 'Ausogo', 'theme' => 'romero'), 'mostvaluablepodcasts' => array('url' => 'http://mostvaluablepodcasts.com/', 'name' => 'Most Valuable Podcasts', 'theme' => 'romero'), 'shortblacktechie' => array('url' => 'http://shortblacktechie.com/', 'name' => 'Short Black Techie', 'theme' => 'romero', 'tags' => array('featured')), 'drummajorsociety' => array('url' => 'http://drummajorsociety.org/', 'name' => 'Drum Major Society', 'theme' => 'romero'), 'wethemeeple' => array('url' => 'http://blog.wethemeeple.co/', 'name' => 'We The Meeple', 'theme' => 'romero'), 'theneocom' => array('url' => 'http://theneocom.com/', 'name' => 'The Neocom', 'theme' => 'romero'), 'psvitaaddict' => array('url' => 'http://psvitaaddict.com/', 'name' => 'PS Vita Addict', 'theme' => 'romero'), 'industrialminds' => array('url' => 'http://industrial-minds.net/', 'name' => 'Industrial Minds', 'theme' => 'romero', 'tags' => array('featured')), 'filmexposure' => array('url' => 'http://filmexposure.ch/', 'name' => 'Film Exposure', 'theme' => 'romero'), 'bestgameever' => array('url' => 'http://bestgameever.co.uk/', 'name' => 'Best Game Ever', 'theme' => 'romero'), 'ninauthority' => array('url' => 'http://ninauthority.com/', 'name' => 'Nintendo Authority', 'theme' => 'romero'), 'barry-corner' => array('url' => 'http://barrycomersblog.com', 'name' => 'Barry Corner', 'theme' => 'monet', 'tags' => array('featured'), 'image' => 'barrycorner'), 'vuurig' => array('url' => 'http://sonjavanvuure.com', 'name' => 'Vuurig', 'theme' => 'monet', 'image' => 'vuurig'), 'legos-and-friends' => array('url' => 'http://legosandfriends.com', 'name' => 'Legos and Friends', 'theme' => 'romero'), 'mgarciadigital' => array('url' => 'https://mgarciadigital.wordpress.com/', 'name' => 'Marco Garcia', 'theme' => 'puzzle', 'image' => 'mgarciadigital', 'tags' => array('puzzle', 'featured')), 'clear-sight' => array('url' => 'http://bjdeming.com', 'name' => 'Clear Sight', 'image' => 'bjdeming', 'theme' => 'opti'), 'press-the-button' => array('url' => 'http://pressthepsbutton.com', 'name' => 'Press the Button', 'theme' => 'chronicle', 'tags' => array('chronicle')), 'hanley-strength' => array('url' => 'http://hanleystrength.com', 'name' => 'Hanley Strength', 'theme' => 'romero', 'tags' => array('featured')), 'should-i-go-see-it' => array('url' => 'http://shouldigoseeit.com', 'name' => 'Should I Go See It', 'image' => 'shouldigoseeit', 'theme' => 'puzzle'), 'noise-nation' => array('url' => 'https://noisenation.wordpress.com', 'name' => 'Noise Nation', 'image' => 'noisenation', 'theme' => 'opti'), 'the-fourth-crown' => array('url' => 'http://thefourthcrown.com', 'name' => 'The Fourth Crown', 'theme' => 'broadsheet', 'tags' => array('featured')), 'torrent-this' => array('url' => 'http://torrentthis.tv', 'name' => 'Torrent This', 'theme' => 'romero', 'tags' => array('romero', 'featured')), 'geeks-down-under' => array('url' => 'http://geeksdownunder.com.au', 'name' => 'Geeks Down Under', 'theme' => 'romero'), 'javier-mardueno' => array('url' => 'http://javiermarduenoblog.com', 'name' => 'Javier Mardueno', 'image' => 'javiermardueno', 'theme' => 'puzzle', 'tags' => array('featured')), 'decograffik' => array('url' => 'http://decograffik.com', 'name' => 'Decograffik', 'image' => 'decograffik', 'theme' => 'puzzle'), 'matthew-aaron-goodman' => array('url' => 'http://matthewaarongoodman.com', 'name' => 'Matthew Aaron Goodman', 'image' => 'matthewaarongoodman', 'theme' => 'puzzle'), 'cynthia-lait' => array('url' => 'http://cynthialait.com', 'name' => 'Cynthia Lait', 'image' => 'cynthialait', 'theme' => 'puzzle'), 'maroc-in-style' => array('url' => 'http://marocinstyle.com', 'name' => 'Maroc in Style', 'image' => 'maroc', 'theme' => 'puzzle'), 'flossy-photography' => array('url' => 'https://flossyphotography.wordpress.com', 'name' => 'Flossy Photography', 'image' => 'flossy', 'theme' => 'puzzle'), 'leah-pellegrini' => array('url' => 'http://leahpellegrini.com', 'name' => 'Leah Pellegrini', 'theme' => 'puzzle'), 'cincindos' => array('url' => 'http://cincindos.com', 'name' => 'Cincindos', 'image' => 'cincindos', 'theme' => 'puzzle'), 'sperka' => array('url' => 'http://sperka.info', 'name' => 'Sperka', 'image' => 'sperka', 'theme' => 'puzzle'), 'vocalise' => array('url' => 'https://ballaratvocalise.wordpress.com', 'name' => 'Vocalise', 'theme' => 'opti'), 'bella-caledonia' => array('url' => 'https://bellacaledonia.wordpress.com', 'name' => 'Bella Caledonia', 'image' => 'bellacaledonia', 'theme' => 'opti', 'tags' => array('featured')), 'national-rail-enquiries' => array('url' => 'http://blog.nationalrail.co.uk', 'name' => 'National Rail Enquiries', 'theme' => 'chronicle', 'tags' => array('featured')), 'berkeley-life-centre' => array('url' => 'http://berkeleylifecentre.org', 'name' => 'Berkeley Life Centre', 'theme' => 'chronicle', 'tags' => array('featured')), 'comic-community' => array('url' => 'https://ccommunity.wordpress.com', 'name' => 'Comic Community', 'theme' => 'chronicle'), 'fedali-photography' => array('url' => 'http://fedalijournal.com', 'name' => 'Fedali Photography', 'image' => 'fedalijournal', 'theme' => 'chronicle'), 'cardinal-courier' => array('url' => 'https://cardinalcourieronline.wordpress.com', 'name' => 'Cardinal Courier', 'theme' => 'broadsheet'), 'orange-county-tribune' => array('url' => 'http://orangecountytribune.com', 'name' => 'Orange County Tribune', 'theme' => 'broadsheet'), 'the-sentinel' => array('url' => 'https://shssentinel.wordpress.com', 'name' => 'The Sentinel', 'theme' => 'broadsheet'), 'gentlemans-portion' => array('url' => 'http://gentlemansportion.com', 'name' => 'Gentlemans Portion', 'theme' => 'broadsheet'), 'solar-spindle' => array('url' => 'http://solarspindle.com', 'name' => 'Solar Spindle', 'theme' => 'broadsheet'), 'probe-inernational' => array('url' => 'http://journal.probeinternational.org', 'name' => 'Probe International', 'theme' => 'broadsheet'), 'the-banner' => array('url' => 'http://thebannercsi.com', 'name' => 'The Banner', 'theme' => 'broadsheet'), 'leonardo-zhangelini' => array('url' => 'http://zanghelini.com.br', 'name' => 'Leonardo Zhangelini', 'theme' => 'monet', 'image' => 'leonardozhangelini'), 'bailey-english-studio' => array('url' => 'http://baileyenglishstudio.com', 'name' => 'Bailey English Studio', 'theme' => 'monet', 'image' => 'baileyenglishstudio'), 'red-electric' => array('url' => 'http://redeclectic.com.au', 'name' => 'Red Electric', 'theme' => 'monet', 'image' => 'redelectric'));
    $processed = array();
    foreach ($websites as $key => $site) {
        // preview url
        $site['url-preview'] = path('showcase-preview/' . $key . '/');
        $site['showcase-target'] = '';
        //var_dump( $site[ 'url' ] );
        //var_dump( strpos( $site[ 'url' ], 'https://' ) );
        if (strpos($site['url'], 'http://') !== false) {
            $site['url-preview'] = $site['url'];
            $site['showcase-target'] = '_blank';
        }
        // preview url
        $site['url-showcase'] = path('theme-showcase/' . $site['theme'] . '/#' . $key);
        // iframe url
        $site['url-iframe'] = $site['url'];
        // add theme slug to tags
        $site['tags'][] = $site['theme'];
        // setup site screenshots
        $site['image-preview'] = site_screenshot($site['url']);
        $site['image-url'] = $site['image-preview'];
        // change dynamic url for static image if it exists. Static image is needed for themes that use js for positioning (masonry) since the dynamic screenshot system does not support js.
        if (!empty($site['image'])) {
            $site['image-url'] = image_path('showcase/' . $site['image'] . '.jpg');
        }
        $processed[$key] = $site;
    }
    return $processed;
}
开发者ID:cutout,项目名称:ptd,代码行数:51,代码来源:websites.php


注:本文中的image_path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。