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


PHP image_style_url函数代码示例

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


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

示例1: template_preprocess_layout__double_fixed_inner_rev

/**
 * Prepare variables for the drawer layout template file.
 */
function template_preprocess_layout__double_fixed_inner_rev(&$variables)
{
    if ($variables['content']['sidebar'] && $variables['content']['drawer']) {
        $variables['classes'][] = 'layout-both-sidebars';
    } elseif ($variables['content']['sidebar'] || $variables['content']['drawer']) {
        $variables['classes'][] = 'layout-one-sidebar';
        if ($variables['content']['sidebar']) {
            $variables['classes'][] = 'layout-has-sidebar';
        } else {
            $variables['classes'][] = 'layout-has-drawer';
        }
    } else {
        $variables['classes'][] = 'layout-no-sidebars';
    }
    // Special handling for header image.
    $variables['main_attributes'] = array('class' => array('l-content'));
    if (arg(0) == 'user' && is_numeric(arg(1)) && !arg(2)) {
        // We are on the user profile page.
        $variables['main_attributes']['class'][] = 'account-page';
        // Check to see if there is a profile image.
        $account = user_load(arg(1));
        // Entity cache should save us here?
        if (isset($account->field_header_photo[LANGUAGE_NONE][0]['uri'])) {
            // Generate an image at the correct size.
            $image = image_style_url('header', $account->field_header_photo[LANGUAGE_NONE][0]['uri']);
            $variables['main_attributes']['style'] = 'background-image: url(' . $image . ')';
            // Add an addidional class.
            $variables['main_attributes']['class'][] = 'has-background';
        }
    }
}
开发者ID:serundeputy,项目名称:backdropcms.org,代码行数:34,代码来源:double_fixed_inner_rev.php

示例2: get_uniq_img_

function get_uniq_img_($row, $preset, $height)
{
    $imagestyle = '';
    !image_style_load($preset) ? $imagestyle = 'thumbnail' : ($imagestyle = $preset);
    $img_src = image_style_url($imagestyle, $row->field_field_blog_image[0]['rendered']['#item']['uri']);
    return "<img src=" . $img_src . " />";
}
开发者ID:Alexabr23,项目名称:bomberos120,代码行数:7,代码来源:views-view-list--blog--block.tpl.php

示例3: hatch_preprocess_node

function hatch_preprocess_node(&$variables)
{
    $variables['view_mode'] = 'teaser';
    $variables['common_pages'] = '';
    $variables['page'] = TRUE;
    $node = $variables['node'];
    $theme_path = drupal_get_path('theme', variable_get('theme_default', NULL));
    $variables['article'] = '';
    if (arg(0) == 'node' && is_numeric(arg(1))) {
        $node = node_load(arg(1));
        if ($node->type == 'article') {
            $variables['article'] = true;
        }
        if ($node->type == 'page') {
            $variables['common_pages'] = true;
        }
        $variables['nextandprev'] = nextandprev();
    }
    if (!isset($node->field_image['und'][0]['uri'])) {
        $variables['image'] = base_path() . $theme_path . '/images/archive_image_placeholder.png';
    } else {
        $img = $node->field_image['und'][0]['uri'];
        $teaser = $variables['teaser'];
        if ($teaser) {
            $variables['image'] = image_style_url('medium', $img);
        } else {
            $variables['image'] = image_style_url('large', $img);
        }
    }
}
开发者ID:hengkit,项目名称:portfolio-drops7,代码行数:30,代码来源:template.php

示例4: generateStyleUris

 /**
  * Process callback to generate the image styles for the current file.
  *
  * @param DataInterpreterInterface $interpreter
  *   The data interpreter for the current article entity.
  * @param string[] $image_styles
  *   Array of image style names.
  *
  * @return array
  *   A list of URLs for this images' image styles.
  */
 public function generateStyleUris(DataInterpreterInterface $interpreter, array $image_styles)
 {
     // Call image_style_url with the retrieved $value for each $image_style.
     $uri = $interpreter->getWrapper()->value()->uri;
     return array_map(function ($image_style) use($uri) {
         return url(image_style_url($image_style, $uri), array('absolute' => $this->isAbsolute));
     }, $image_styles);
 }
开发者ID:e0ipso,项目名称:restful-session-example,代码行数:19,代码来源:Images__1_0.php

示例5: odsherredsub_image_style

function odsherredsub_image_style($variables)
{
    // Determine the dimensions of the styled image.
    $dimensions = array('width' => $variables['width'], 'height' => $variables['height']);
    image_style_transform_dimensions($variables['style_name'], $dimensions);
    $variables['width'] = $dimensions['width'];
    $variables['height'] = $dimensions['height'];
    $variables['attributes'] = array('class' => $variables['style_name']);
    // Determine the url for the styled image.
    $variables['path'] = image_style_url($variables['style_name'], $variables['path']);
    return theme('image', $variables);
}
开发者ID:odsherred,项目名称:subsites.odsherred.dk,代码行数:12,代码来源:template.php

示例6: image

 public static function image($type, $value, $name, $imageStyle = '')
 {
     if (!self::checkFieldValue($value, 'uri')) {
         return null;
     }
     if ($imageStyle !== '') {
         $processed = image_style_url($imageStyle, $value['uri']);
     } else {
         $processed = file_create_url($value['uri']);
     }
     return new ImageFieldValue($value, $processed, $type);
 }
开发者ID:ryne-andal,项目名称:ablecore,代码行数:12,代码来源:Core.php

示例7: newsweek_image_style

function newsweek_image_style($variables)
{
    // Determine the dimensions of the styled image.
    $dimensions = array('width' => $variables['width'], 'height' => $variables['height']);
    image_style_transform_dimensions($variables['style_name'], $dimensions);
    $variables['width'] = $dimensions['width'];
    $variables['height'] = $dimensions['height'];
    // Determine the URL for the styled image.
    $variables['path'] = image_style_url($variables['style_name'], $variables['path']);
    if (module_exists('ibtmedia_special_item') && ibtmedia_special_item_is_any_special_item_page()) {
        $variables['title'] = NULL;
    }
    return theme('image', $variables);
}
开发者ID:johnedelatorre,项目名称:fusion,代码行数:14,代码来源:template.php

示例8: calbarber_theme_preprocess_page

function calbarber_theme_preprocess_page(&$variables)
{
    if (arg(0) == "node" && is_numeric(arg(1))) {
        $nodeid = arg(1);
        $thenode = node_load($nodeid);
        //dpm($thenode);
        if (!empty($thenode->field_page_bgimage)) {
            $image_style_path = image_style_url("background_image", $thenode->field_page_bgimage['und'][0]['uri']);
            drupal_add_css("@media (min-width: 650px) {.main-section {background-image: url('{$image_style_path}') !important}}", array('type' => 'inline', 'group' => 'CSS_THEME', 'preprocess' => FALSE, 'media' => 'screen'));
        }
        if (!empty($thenode->field_page_hide_content) && $thenode->field_page_hide_content['und'][0]['value'] == 1) {
            drupal_add_css(".not-logged-in .main-content-box { \n\t\t\t\tposition: absolute; \n\t\t\t\theight: 1px;\n\t\t\t\twidth: 1px;\n\t\t\t\ttop: -990px;\n\t\t\t\tleft: -999px;\n\t\t\t\toverflow: hidden;\n\t\t\t}", array('type' => 'inline', 'group' => 'CSS_THEME', 'preprocess' => FALSE, 'media' => 'screen'));
        }
    }
}
开发者ID:lluisandreu,项目名称:drupal7,代码行数:15,代码来源:template.php

示例9: imageSrc

 public function imageSrc($image, $style = null)
 {
     if (empty($image)) {
         return '';
     }
     $uri = null;
     if (is_scalar($image)) {
         $uri = (string) $image;
     } else {
         if (is_object($image)) {
             $image = (array) $image;
         }
         $uri = $image['uri'];
     }
     if ($style) {
         return image_style_url($style, $uri);
     } else {
         return file_create_url($uri);
     }
 }
开发者ID:makinacorpus,项目名称:drupal-sf-dic,代码行数:20,代码来源:DrupalImageExtension.php

示例10: portfolino_get_gallery

function portfolino_get_gallery()
{
    $query = new EntityFieldQuery();
    $i = (int) theme_get_setting('perpage_thumbs');
    $result = $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'article')->range(0, $i)->execute();
    $nids = array_keys($result['node']);
    $nodes = entity_load('node', $nids);
    $output = "";
    foreach ($nodes as $node) {
        $output .= "<a href='node/{$node->nid}' class='item'>";
        $output .= "<img src='" . image_style_url('medium', $node->field_image['und'][0]['uri']) . "' alt='{$node->title}'>";
        $output .= "<h3>{$node->title}</h3><p>";
        foreach ($node->field_tags['und'][0] as $tid) {
            $tax = taxonomy_term_load($tid);
            $output .= (isset($tax->name) ? $tax->name : '') . ", ";
        }
        $output .= "</p></a>";
    }
    return $output;
}
开发者ID:stahiralijan,项目名称:portfolino,代码行数:20,代码来源:template.php

示例11: pribehovymotiv_preprocess_comment

function pribehovymotiv_preprocess_comment(&$variables)
{
    /*nutne deklarace*/
    $comment = $variables['elements']['#comment'];
    /*
     * Úprava komentářových dat pro zobrazení – u needitovaných komentářů nezobrazujeme informaci o editaci
     * bohužel created / changed se často liší o pár sekund, takže je potřeba počítat s jistou hysterezí...
     * */
    if ($comment->changed - $comment->created < 10) {
        $variables['changed'] = '';
        //TODO jak moc velká prasárna je, když tu není nic? Changed se zobrazí, ale prázdný...
    } else {
        $variables['changed'] = t('Edited') . " " . format_date($comment->changed);
    }
    /*zamezime zobrazeni odkazu, ktere nechceme*/
    unset($variables['content']['links']['comment']['#links']['comment-reply']);
    unset($variables['links']['comment']['#links']['comment_forbidden']);
    $variables['user_picture'] = '';
    $UzivatelskaIkona = '';
    $UzivatelskaIkonaURL = '';
    // dpm($comment);
    if (!empty($comment->uid)) {
        $profiledata = profile2_by_uid_load($comment->uid, 'main');
        if ($profiledata) {
            //vytahne z rozsireneho profilu uzivatelskou ikonu a zobrazi ji
            $UzivatelskaIkona = field_get_items('profile2', $profiledata, 'field_profil_ikonka');
            if (!is_array($UzivatelskaIkona)) {
                //uzivatel nema ikonu, potrebujeme implicitni!
                $info = field_info_field('field_profil_ikonka');
                $default_icon = file_load($info["settings"]["default_image"])->uri;
                $UzivatelskaIkonaURL = image_style_url("ikona", $default_icon);
            } else {
                //zobrazit uzivatelovu ikonu
                $UzivatelskaIkonaURL = image_style_url("ikona", $UzivatelskaIkona[0]['uri']);
            }
            $variables['user_picture'] = '<img src=' . $UzivatelskaIkonaURL . '>';
        }
    }
}
开发者ID:ChuanD,项目名称:sp_drupal_theme,代码行数:39,代码来源:template.php

示例12: plain_response_image_style

/**
 * Override for theme_image_style
 * Adds custom styles for this theme
 */
function plain_response_image_style($variables)
{
    // Determine the dimensions of the styled image.
    $dimensions = array('width' => $variables['width'], 'height' => $variables['height']);
    image_style_transform_dimensions($variables['style_name'], $dimensions);
    $variables['width'] = $dimensions['width'];
    $variables['height'] = $dimensions['height'];
    $original_path = $variables['path'];
    $variables['attributes']['data-originalsrc'] = $original_path;
    // Determine the url for the styled image.
    $variables['path'] = image_style_url($variables['style_name'], $original_path);
    // Use quarter as default size.
    if (strpos($variables['style_name'], 'plain_response_') === 0) {
        $variables['path'] = image_style_url('plain_response_quarter', $original_path);
        if (!isset($variables['attributes']['class'])) {
            $variables['attributes']['class'] = '';
        }
        $variables['attributes']['class'] .= ' ' . str_replace('plain_response_', '', $variables['style_name']);
        unset($variables['width']);
        unset($variables['height']);
    }
    return theme('image', $variables);
}
开发者ID:rtrvrtg,项目名称:Plain-Response,代码行数:27,代码来源:template.php

示例13: image_style_url

<?php

$output = image_style_url('slider_wide', $output);
?>
  <div class="slider" style="background-image: url('<?php 
print $output;
?>
');">
    <div class="slider__container">
      <div class="slider__logo">&nbsp;</div>
    </div>
  </div>
开发者ID:web-padawan,项目名称:evrotehnica.com.ua,代码行数:12,代码来源:views-view-field--slider--block--uri.tpl.php

示例14: l

		$data = $row->field_field_portfolio_image;
		if (!count($data)) {
			continue;
		}
		
		$image = $row->field_field_portfolio_image[0]['raw'];
		// add captions to an empty array
		if (isset($image['title'])) {
			$captions["caption-fid-" . $image['fid']] = '<div class="header"><h3>' 
			.	l($row->node_title, 'node/' . $row->nid) . '</h3></div><div class="body">'  
			.	drupal_render($row->field_body)
			. '</div>'
			. l(t('read more'), 'node/' . $row->nid, array('attributes' => array('class' => array('button_link'))));
		}
		
		$file = $data[0]['rendered'];
		// assign iamge style
		$style = isset($file['#image_style']) && !empty($file['#image_style']) ? $file['#image_style'] :
		variable_get('glossy_style_ff_slideshow', 'front_featured_slideshow_image');
	?>
  <a href="<?php print url('node/' . $row->nid); ?>"><img src="<?php print image_style_url($style, $file['#item']['uri']); ?>" alt="<?php print $image['alt']; ?>" title="#caption-fid-<?php print $image['fid']; ?>"/></a>
<?php endforeach;?>
</div>

<div id="nivo-htmlcaptions">
	<?php foreach ($captions as $id => $caption): ?>
		<div id="<?php print $id; ?>" class="nivo-html-caption">
				<div class="nivo-caption-inner"><?php print $caption; ?></div>
		</div>
	<?php endforeach;?>
</div>
开发者ID:redtrayworkshop,项目名称:msdworkshop,代码行数:31,代码来源:views-view-fields--ff-nivo-slider.tpl.php

示例15: isset

  * - $view: The view object
  * - $field: The field handler object that can process the input
  * - $row: The raw SQL result that can be used
  * - $output: The processed output that will normally be used.
  *
  * When fetching output from the $row, this construct should be used:
  * $data = $row->{$field->field_alias}
  *
  * The above will guarantee that you'll always get the correct data,
  * regardless of any changes in the aliasing that might happen if
  * the view is modified.
  */
	
// Print only portfolio item
$data = $row->field_field_portfolio_image;
if (!count($data)) {
	return;
}

$file = $data[0]['rendered'];
// assign image style
$style = isset($file['#image_style']) && !empty($file['#image_style']) ? $file['#image_style'] :
 variable_get('glossy_style_ff_slideshow', 'front_featured_slideshow_image');
?>

<Image Source="<?php print image_style_url($style, $file['#item']['uri']); ?>" Title="<?php print $file['#item']['title']; ?>">
	<Text><h1><?php print $row->node_title; ?></h1><?php print array_shift($row->field_body[0]['rendered']); ?></Text>
	<Hyperlink URL="<?php print url('node/' . $row->nid); ?>" Target="_self"/>
</Image>

开发者ID:redtrayworkshop,项目名称:msdworkshop,代码行数:29,代码来源:views-view-field--xml-source--field-portfolio-image.tpl.php


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