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


PHP image_tag函数代码示例

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


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

示例1: getSlotValue

 public function getSlotValue($slot)
 {
     sfLoader::loadHelpers(array('Asset', 'Url', 'Tag'));
     $params = sfYaml::load($slot->getValue());
     $res = '';
     if (isset($params['legend'])) {
         $res .= content_tag('p', $params['legend'], array('class' => 'image_legend'));
         $params['alt'] = $params['legend'];
         unset($params['legend']);
     }
     if (isset($params['url'])) {
         $url = $params['url'];
         unset($params['url']);
     }
     if (!isset($params['src'])) {
         return sprintf('<strong>Error</strong>: The value of slot %s in incorrect. The image has no source', $slot->getName());
     }
     $src = $params['src'];
     unset($params['src']);
     $res = image_tag($src, $params) . $res;
     if (isset($url)) {
         return link_to($res, $url);
     } else {
         return $res;
     }
 }
开发者ID:net7,项目名称:Talia-CMS,代码行数:26,代码来源:sfSimpleCMSSlotImage.class.php

示例2: image_tag_sf_image

/**
 * Returns a image tag for sfImageHandler.
 *
 * @param string $filename
 * @param array  $options
 *
 * @return string  An image tag.
 */
function image_tag_sf_image($filename, $options = array())
{
    if (empty($options['alt'])) {
        $options['alt'] = '';
    }
    if (!$filename) {
        if (isset($options['no_image'])) {
            $filename = $options['no_image'];
            unset($options['no_image']);
        } else {
            $filename = 'no_image.gif';
        }
        return image_tag($filename, $options);
    }
    $filepath = sf_image_path($filename, $options);
    if (isset($options['size'])) {
        unset($options['size']);
    }
    if (isset($options['no_image'])) {
        unset($options['no_image']);
    }
    if (isset($options['f'])) {
        unset($options['f']);
    }
    if (isset($options['format'])) {
        unset($options['format']);
    }
    return image_tag($filepath, $options);
}
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:37,代码来源:sfImageHelper.php

示例3: link_to_star

function link_to_star($object, $options = array())
{
    $user = sfContext::getInstance()->getUser();
    if ($user->isAuthenticated()) {
        $response = sfContext::getInstance()->getResponse();
        $has_jquery = sfConfig::get('app_sfPropelActAsStarredBehaviorPlugin_has_jquery');
        if (!$has_jquery) {
            $response->addJavascript('/sfPropelActAsStarredBehaviorPlugin/js/jquery-1.2.2.pack');
        }
        $response->addJavascript('/sfPropelActAsStarredBehaviorPlugin/js/sf_star');
        $is_starred = $object->isStarred() ? 'sf_star_on' : 'sf_star_off';
        $options = _parse_attributes($options);
        if (isset($options['class'])) {
            $options['class'] .= ' sf_star ' . $is_starred;
        } else {
            $options['class'] = 'sf_star ' . $is_starred;
        }
        $type = sfConfig::get('app_sfPropelActAsStarredBehaviorPlugin_content_type', null);
        if (!$type || $type == 'image') {
            $content = $object->isStarred() ? image_tag(sfConfig::get('app_sfPropelActAsStarredBehaviorPlugin_image_on', '/sfPropelActAsStarredBehaviorPlugin/images/star_on.gif')) : image_tag(sfConfig::get('app_sfPropelActAsStarredBehaviorPlugin_image_off', '/sfPropelActAsStarredBehaviorPlugin/images/star_off.gif'));
        } elseif (isset($options['txt_on']) && isset($options['txt_off'])) {
            $content = $object->isStarred() ? $options['txt_off'] : $options['txt_on'];
        } else {
            $content = $object->isStarred() ? sfConfig::get('app_sfPropelActAsStarredBehaviorPlugin_content_on') : sfConfig::get('app_sfPropelActAsStarredBehaviorPlugin_content_off');
        }
        $model = get_class($object);
        $id = $object->getPrimaryKey();
        return link_to($content, 'sfStar/starit?model=' . $model . '&id=' . $id, $options);
        // return content_tag('span',link_to($image,'sfStar/starit?model='.$model.'&id='.$id,'class=sf_star'));
    } else {
        return content_tag('span', '');
    }
}
开发者ID:sgrove,项目名称:cothinker,代码行数:33,代码来源:StarHelper.php

示例4: get_sympal_pager_navigation

/**
 * Get the navigation links for given sfDoctrinePager instance
 *
 * @param sfDoctrinePager $pager
 * @param string $uri  The uri to prefix to the links
 * @return string $html
 */
function get_sympal_pager_navigation($pager, $uri, $requestKey = 'page')
{
    sympal_use_stylesheet('/sfSympalPlugin/css/pager.css');
    $navigation = '<div class="sympal_pager_navigation">';
    if ($pager->haveToPaginate()) {
        $uri .= (preg_match('/\\?/', $uri) ? '&' : '?') . $requestKey . '=';
        // First and previous page
        if ($pager->getPage() != 1) {
            $navigation .= link_to(image_tag('/sf/sf_admin/images/first.png', 'align=absmiddle'), $uri . '1');
            $navigation .= link_to(image_tag('/sf/sf_admin/images/previous.png', 'align=absmiddle'), $uri . $pager->getPreviousPage()) . ' ';
        }
        // Pages one by one
        $links = array();
        foreach ($pager->getLinks() as $page) {
            $links[] = '<span>' . link_to_unless($page == $pager->getPage(), $page, $uri . $page) . '</span>';
        }
        $navigation .= join('  ', $links);
        // Next and last page
        if ($pager->getPage() != $pager->getLastPage()) {
            $navigation .= ' ' . link_to(image_tag('/sf/sf_admin/images/next.png', 'align=absmiddle'), $uri . $pager->getNextPage());
            $navigation .= link_to(image_tag('/sf/sf_admin/images/last.png', 'align=absmiddle'), $uri . $pager->getLastPage());
        }
    }
    $navigation .= '</div>';
    return $navigation;
}
开发者ID:RafalJachimczyk,项目名称:sympal,代码行数:33,代码来源:SympalPagerHelper.php

示例5: light_image

/**
 * Returns an image link to use the lightbox function for 1 image.
 *
 * @param thumb_url          thumbnail url
 * @param image_url          full image url
 * @param image_link_options additional html attributes to add to image link (e.g.: array ('title' => 'My image'))
 * @param thumb_options      additional html attributes to add to thumb image tag (e.g.: array ('border' => 5))
 * 
 * @author Artur Rozek
 */
function light_image($thumb_url, $image_url, $image_link_options = array(), $thumb_options = array())
{
    //make lightbox effect
    $thumb_tag = image_tag($thumb_url, $thumb_options);
    $image_link_options['class'] = isset($image_link_options['class']) ? $image_link_options['class'] . " lightbox" : 'lightbox';
    echo link_to($thumb_tag, $image_url, $image_link_options);
}
开发者ID:robo47,项目名称:sfJQueryLightboxPlugin,代码行数:17,代码来源:sfJQueryLightboxHelper.php

示例6: sortIcon

 public function sortIcon($sort_dir, $popup)
 {
     if ($sort_dir != 'desc') {
         $sort_dir = 'asc';
     }
     return link_to(image_tag("/lyMediaManagerPlugin/images/sort-{$sort_dir}", "alt={$sort_dir}"), '@ly_media_asset_icons?&dir=' . ($sort_dir == 'desc' ? 'asc' : 'desc') . ($popup ? '&popup=1' : ''), array('title' => 'Switch sort direction'));
 }
开发者ID:vjousse,项目名称:lyMediaManagerPlugin,代码行数:7,代码来源:lyMediaAssetGeneratorHelper.class.php

示例7: image_cache_tag

function image_cache_tag($route, $format, $path, $image, $alt = null)
{
    $_formats = sfConfig::get('imagecache_formats');
    $_format = $_formats[$format];
    if (!isset($_format)) {
        throw new RuntimeException('Format not found');
    }
    $real_file_path = sfConfig::get('sf_upload_dir') . '/' . $path . '/' . $image;
    if (file_exists($real_file_path)) {
        $cache_file_path = sfConfig::get('sf_upload_dir') . '/cache/' . $format . '/' . $path . '/' . $image;
        $is_cached_file = file_exists($cache_file_path);
        $options = array('path' => $format . '/' . $path . '/' . $image);
        $url = urldecode(url_for($route, $options));
        if ($is_cached_file) {
            $cached_image = new sfImage($cache_file_path);
            $width = $cached_image->getWidth();
            $height = $cached_image->getHeight();
            return image_tag($url, array('size' => $width . 'x' . $height, 'alt' => $alt));
        } else {
            return image_tag($url, array('alt' => $alt));
        }
    } else {
        return '';
    }
}
开发者ID:GrifiS,项目名称:SyrexCMS,代码行数:25,代码来源:ImageCacheHelper.php

示例8: print_celula_tabela_consolidado

function print_celula_tabela_consolidado($mes, $ano, $statusConta, $listaContas)
{
    ?>
  <?php 
    $loteContas = Conta::getLoteFromListaContas($statusConta, $ano, $mes, $listaContas);
    ?>
  <div class="overlay">
	  <div><?php 
    print_valor(Conta::getTotalFromLote($loteContas));
    ?>
</div>
	  <a rel="#overlay" href="<?php 
    echo url_for('financeiro/addConta?ano=' . $ano->getAno() . '&mes=' . $mes . '&statusConta=' . $statusConta->getSlug());
    ?>
"><?php 
    echo image_tag("add-conta.png");
    ?>
</a>
	  <?php 
    if (count($loteContas) > 0) {
        ?>
	   <a rel="#overlay" href="<?php 
        echo url_for('financeiro/listaContas?ano=' . $ano->getAno() . '&mes=' . $mes . '&statusConta=' . $statusConta->getSlug());
        ?>
"><?php 
        echo image_tag("list-conta.png", array('width' => 32, 'heigth' => 32));
        ?>
</a>
	  <?php 
    }
    ?>
  </div> 
<?php 
}
开发者ID:robertcosta,项目名称:symfony-condomino,代码行数:34,代码来源:ConsolidadoHelper.php

示例9: cryptographp_reload

function cryptographp_reload()
{
    $reload_img = sfConfig::get('app_cryptographp_reloadimg', '/sfCryptographpPlugin/images/reload');
    //$ret = "<a style=\"cursor:pointer\" onclick=\"javascript:document.getElementById('cryptogram').src='".url_for('cryptographp/index?id=')."/'+Math.round(Math.random(0)*1000)+1\">".image_tag('/sfCryptographpPlugin/images/reload')."</a>";
    $ret = "<a style=\"cursor:pointer\" onclick=\"javascript:document.getElementById('cryptogram').src='" . url_for('cryptographp/index?id=') . "/'+Math.round(Math.random(0)*1000)+1\">" . image_tag($reload_img) . "</a>";
    return $ret;
}
开发者ID:sgrove,项目名称:cothinker,代码行数:7,代码来源:CryptographpHelper.php

示例10: a_remote_dialog_toggle

function a_remote_dialog_toggle($options)
{
    if (!isset($options['id'])) {
        throw new sfException("Required id option not passed to a_dialog_toggle");
    }
    if (!isset($options['label'])) {
        throw new sfException("Required label option not passed to a_dialog_toggle");
    }
    if (!isset($options['action'])) {
        throw new sfException("Required action option not passed to a_dialog_toggle");
    }
    $id = $options['id'];
    $action = $options['action'];
    $label = $options['label'];
    if (isset($options['chadFrom'])) {
        $chadFrom = $options['chadFrom'];
    }
    if (isset($options['loading'])) {
        $loading = $options['loading'];
    }
    if (isset($options['hideToggle']) && $options['hideToggle'] == true) {
        $before = " \$('.{$id}-loading').show();";
    } else {
        $before = "\$('.{$id}-button.open').hide(); \$('.{$id}-loading').show();";
    }
    $s = '';
    $s .= jq_link_to_remote(__($label, null, 'apostrophe'), array("url" => $action, "update" => $id, "script" => true, "before" => $before, "complete" => "\$('#{$id}').fadeIn();\n  \t\t\t\t\t\t\t\t\t \$('.{$id}-loading').hide();\n\t\t\t\t\t\t\t\t\t\t \t\$('.{$id}-button.open').hide();\n  \t\t\t\t\t\t\t\t\t \$('#{$id}-button-close').show();" . (isset($chadFrom) ? "var arrowPosition = parseInt(\$('{$chadFrom}').offset().left);\n      \t\t\t\t\t\t\t\t \$('#{$id} .a-chad').css('left',arrowPosition+'px'); " : "") . "\n  \t\t\t\t\t\t\t\t\t aUI('#{$id}');\n  \t\t\t\t\t\t\t\t\t\$('.a-page-overlay').show();"), array('class' => "{$id}-button open", 'id' => "{$id}-button-open"));
    $s .= jq_link_to_function(__($label, null, 'apostrophe'), "\$('#{$id}-button-close').hide(); \n\t\t \$('#{$id}-button-open').show(); \n\t\t \$('#{$id}').hide();\n\t\t \$('.a-page-overlay').hide();", array('class' => "{$id}-button close", 'id' => "{$id}-button-close", 'style' => 'display:none;'));
    if (isset($loading)) {
        $s .= image_tag($loading, array('class' => "{$id}-loading", 'style' => 'display:none;'));
    }
    return $s;
}
开发者ID:verenate,项目名称:gri,代码行数:33,代码来源:PkDialogHelper.php

示例11: test_image_tag

 function test_image_tag()
 {
     $this->assertEqual('<img src="mocked_stylesheet_directory/assets/images/source.png" alt="Source"/>', image_tag("source.png"));
     $this->assertEqual('<img src="/source.png" alt="Source"/>', image_tag("/source.png"));
     $this->assertEqual('<img src="http://welaika.com/source.png" alt="Source"/>', image_tag("http://welaika.com/source.png"));
     $this->assertEqual('<img src="http://welaika.com/source.png" alt="test" class="image"/>', image_tag("http://welaika.com/source.png", array("alt" => "test", "class" => "image")));
 }
开发者ID:nerdfiles,项目名称:brooklynmeatballcompany_com,代码行数:7,代码来源:asset_tag_helper_test.php

示例12: render

 public function render()
 {
     $result = '';
     $page = DbFinder::from('W3sPage')->with('W3sTemplate', 'W3sProject')->leftJoin('W3sGroup')->leftJoin('W3sTemplate')->leftJoin('W3sProject')->findPK($this->idPage);
     $slots = W3sSlotPeer::getTemplateSlots($page->getW3sGroup()->getTemplateId());
     $i = 0;
     foreach ($slots as $slot) {
         $idSlot = $slot->getId();
         $class = $i / 2 == intval($i / 2) ? "w3s_white_row" : "w3s_blue_row";
         switch ($slot->getRepeatedContents()) {
             case 0:
                 $repeatedColor = 'green';
                 $repeatedAlt = __('This contents is not repeated through pages');
                 break;
             case 1:
                 $repeatedColor = 'orange';
                 $repeatedAlt = __('This contents is repeated at group level');
                 break;
             case 2:
                 $repeatedColor = 'blue';
                 $repeatedAlt = __('This contents is repeated at site level');
                 break;
         }
         $result .= sprintf($this->rowSkeleton, $this->idLanguage . $idSlot, $class, $idSlot, link_to_function($slot->getSlotName(), 'W3sControlPanel.showRepeatedContentsForm(' . $idSlot . ');', 'onmouseover="W3sControlPanel.highlightSlot(\'' . $slot->getSlotName() . '\', ' . $slot->getRepeatedContents() . ')"'), image_tag(sfConfig::get('app_w3s_web_skin_images_dir') . '/control_panel/button_slot_' . $repeatedColor . '.jpg', 'title=' . $repeatedAlt . ' size=14x14'));
         $i++;
     }
     return sprintf('<div id="w3s_slot_list">%s</div>', $result);
 }
开发者ID:jmp0207,项目名称:w3studiocms,代码行数:28,代码来源:w3sSlotManager.class.php

示例13: testImageTag

 public function testImageTag()
 {
     $this->assertDomEqual(image_tag('stato.png'), '<img alt="Stato" src="/images/stato.png" />');
     $this->assertDomEqual(image_tag('stato.png', array('size' => '80x30')), '<img alt="Stato" src="/images/stato.png" width="80" height="30" />');
     $this->assertDomEqual(image_tag('stato.png', array('alt' => 'Stato framework')), '<img alt="Stato framework" src="/images/stato.png" />');
     $this->assertDomEqual(image_tag('http://statoproject.com/images/stato.png'), '<img alt="Stato" src="http://statoproject.com/images/stato.png" />');
 }
开发者ID:BackupTheBerlios,项目名称:stato-svn,代码行数:7,代码来源:asset_tag_helper.test.php

示例14: input_asset_tag

function input_asset_tag($name, $value, $options = array())
{
    use_helper('Javascript', 'I18N');
    $type = 'all';
    if (isset($options['images_only'])) {
        $type = 'image';
        unset($options['images_only']);
    }
    $form_name = 'this.previousSibling.previousSibling.form.name';
    if (isset($options['form_name'])) {
        $form_name = '\'' . $options['form_name'] . '\'';
        unset($options['form_name']);
    }
    $html = '';
    if (is_file(sfConfig::get('sf_web_dir') . $value)) {
        $ext = substr($value, strpos($value, '.') - strlen($value) + 1);
        if (in_array($ext, array('png', 'jpg', 'gif'))) {
            $image_path = $value;
        } else {
            if (!is_file(sfConfig::get('sf_plugins_dir') . '/sfMediaLibraryPlugin/web/images/' . $ext . '.png')) {
                $ext = 'unknown';
            }
            $image_path = '/sfMediaLibraryPlugin/images/' . $ext;
        }
        $html .= link_to_function(image_tag($image_path, array('alt' => 'File', 'height' => '64')), "window.open('{$value}')");
        $html .= '<br />';
    }
    $html .= input_tag($name, $value, $options);
    $html .= '&nbsp;' . image_tag('/sfMediaLibraryPlugin/images/folder_open', array('alt' => __('Insert Image'), 'style' => 'cursor: pointer; vertical-align: middle', 'onclick' => 'sfMediaLibrary.openWindow({ form_name: ' . $form_name . ', field_name: \'' . $name . '\', type: \'' . $type . '\', scrollbars: \'yes\' })'));
    $html .= init_media_library();
    return $html;
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:32,代码来源:sfMediaLibraryHelper.php

示例15: config_explanation

/**
 * UI function to build an image icon with hover tooltip text.
 * Used in the config module initially.
 *
 * @param $tooltipText
 * @param string $image
 * @return string
 */
function config_explanation($tooltipText, $image = 'icon_info.png')
{
    return sprintf('<span class="config_explanation" style="position: relative;">
                %s
                <span class="tooltip from-above leftie">%s</span>
            </span>', image_tag($image, array('style' => 'margin: 0 5px; vertical-align: middle; cursor: pointer;')), $tooltipText);
}
开发者ID:AzerothShard,项目名称:thebuggenie,代码行数:15,代码来源:ui.inc.php


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