本文整理汇总了PHP中sf_image_path函数的典型用法代码示例。如果您正苦于以下问题:PHP sf_image_path函数的具体用法?PHP sf_image_path怎么用?PHP sf_image_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sf_image_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: op_activity_image_uri
/**
* Returns a url for the activity image
*
* @param ActivityImage $activityImage
* @param mixed[] $options
* @param bool $absolute
* @return string
*/
function op_activity_image_uri($activityImage, $options = array(), $absolute = false)
{
use_helper('sfImage');
if ($activityImage->relatedExists('File')) {
return sf_image_path($activityImage->File, $options, $absolute);
} else {
return $activityImage->uri;
}
}
示例3: op_api_message
function op_api_message($messageList, $member, $useIsReadFlag = false)
{
$message = $messageList->getSendMessageData();
$body = preg_replace(array('/<op:.*?>/', '/<\\/op:.*?>/'), '', $message->getBody());
$body = preg_replace('/http.:\\/\\/maps\\.google\\.co[[:graph:]]*/', '', $body);
$body = op_auto_link_text($body);
$imagePath = null;
$imageTag = null;
$image = $message->getMessageFile();
if (0 < count($image)) {
$imageTag = image_tag_sf_image($image[0]->getFile(), array('size' => '76x76'));
$imagePath = sf_image_path($image[0]->getFile());
}
$data = array('id' => $message->getId(), 'member' => op_api_member($member), 'subject' => $message->getSubject(), 'body' => nl2br($body), 'summary' => op_truncate(op_decoration($body, true), 25, '...'), 'image_path' => $imagePath, 'image_tag' => $imageTag, 'created_at' => $message->getCreatedAt(), 'formatted_date' => get_formatted_date($message->getCreatedAt()));
if ($useIsReadFlag) {
$data['is_read'] = $messageList->isSelf() ? (bool) $messageList->getIsRead() : null;
}
return $data;
}
示例4: 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);
// strip options for sf_image_path()
foreach (array('size', 'no_image', 'f', 'format', 'square') as $optionName) {
if (isset($options[$optionName])) {
unset($options[$optionName]);
}
}
return image_tag($filepath, $options);
}
示例5: op_api_diary_image
function op_api_diary_image($image, $size = '120x120')
{
if ($image) {
return array('filename' => sf_image_path($image->getFile()->getName()), 'imagetag' => image_tag_sf_image($image->getFile()->getName(), array('size' => $size)));
}
}
示例6: findImageFileUrlsByMemberIds
/**
*
* @return array
* (memberId => imagePath...)
*/
public function findImageFileUrlsByMemberIds($memberIds)
{
static $queryCacheHash;
$q = Doctrine_Query::create();
if (!$queryCacheHash) {
$q->from('MemberImage mi, mi.File f');
$q->select('mi.member_id, f.name');
$searchResult = $q->fetchArray();
$queryCacheHash = $q->calculateQueryCacheHash();
} else {
$q->setCachedQueryCacheHash($queryCacheHash);
$searchResult = $q->fetchArray();
}
$imageUrls = array();
foreach ($searchResult as $row) {
$image = sf_image_path($row['File']['name'], array('size' => '48x48'), true);
$imageUrls[$row['member_id']] = $image;
}
//画像を設定していないユーザーはno_imageにする
foreach ($memberIds as $id) {
if (!isset($imageUrls[$id])) {
$imageUrls[$id] = opTimelineImage::getNotImageUrl();
}
}
return $imageUrls;
}
示例7: op_mobile_page_title
<?php
op_mobile_page_title($community->getName(), __('Edit %community% Photo'));
?>
<center>
<?php
if ($community->getImageFileName()) {
echo op_image_tag_sf_image($community->getFile(), array('size' => '120x120', 'format' => 'jpg'));
?>
<br>
<?php
echo sprintf('[%s | %s]', link_to(__('Expansion'), sf_image_path($community->getFile(), array('size' => '320x320', 'format' => 'jpg'))), link_to(__('Delete'), '@community_deleteImage?id=' . $community->getId()));
?>
<br><br>
<?php
} else {
echo __('This %community% doesn\'t have a photo.');
}
?>
</center>
<hr color="<?php
echo $op_color["core_color_12"];
?>
">
<?php
if (!$community->getImageFileName()) {
echo __('Send E-mail that has a photo to use as %community%\'s image.');
?>
<br>
<?php
echo op_mail_to('community_add_image', array('id' => $community->id), __('Send E-mail'));
示例8: use_helper
<?php
use_helper('sfImage');
?>
<div class="cell">
<dl>
<dt class="day"><?php
echo $image->getCreatedAt();
?>
</dt>
<dd class="upImage"><a href="<?php
echo sf_image_path($image->getName());
?>
"><?php
echo image_tag_sf_image($image->getName(), $options = array('size' => '120x120'));
?>
</a></dd>
<dd class="fileName"><?php
echo $image->getOriginalFilename();
?>
</dd>
<?php
if ($deleteBtn) {
?>
<dd class="delete">
[ <?php
echo link_to(__('削除する'), 'monitoring/deleteImage?id=' . $image->getId());
?>
]
</dd>
<?php
示例9: op_api_notification
function op_api_notification($notification)
{
if ($notification['icon_url']) {
$iconUrl = $notification['icon_url'];
} else {
if ('link' === $notification['category']) {
$fromMember = Doctrine::getTable('Member')->find($notification['member_id_from']);
$fromMemberImageFileName = $fromMember ? $fromMember->getImageFileName() : null;
if ($fromMemberImageFileName) {
$iconUrl = sf_image_path($fromMemberImageFileName, array('size' => '48x48'), true);
}
}
}
if (!$iconUrl) {
$iconUrl = op_image_path('no_image.gif', true);
} elseif (false !== strpos('http://', $iconUrl)) {
$iconUrl = sf_image_path($iconUrl, array('size' => '48x48'), true);
}
return array('id' => $notification['id'], 'body' => sfContext::getInstance()->getI18N()->__($notification['body']), 'category' => $notification['category'], 'unread' => $notification['unread'], 'created_at' => date('r', strtotime($notification['created_at'])), 'icon_url' => $iconUrl, 'url' => $notification['url'] ? url_for($notification['url'], array('abstract' => true)) : null, 'member_id_from' => $notification['member_id_from']);
}
示例10: op_mobile_page_title
<?php
op_mobile_page_title(__('Settings'), __('Edit Photo'));
?>
<center>
<?php
$_member = $sf_user->getMember();
$images = $_member->getMemberImage();
if ($images->count()) {
foreach ($images as $image) {
echo image_tag_sf_image($image->getFile(), array('size' => '120x120', 'format' => 'jpg'));
?>
<br>
<?php
echo sprintf('[%s]', link_to(__('Expansion'), sf_image_path($image->getFile(), array('size' => '320x320', 'format' => 'jpg'))));
?>
<br>
<?php
if ($image->getIsPrimary()) {
$main = __('Main Photo');
} else {
$main = link_to(__('Main Photo'), 'member/changeMainImage?member_image_id=' . $image->getId());
}
echo sprintf('[%s|%s]', link_to(__('Delete'), 'member/deleteImage?member_image_id=' . $image->getId()), $main);
?>
<br><br>
<?php
}
} else {
echo __('There are no photos.');
}
示例11: op_format_date
]<?php
echo op_format_date($comment->getCreatedAt(), 'MM/dd HH:mm');
if ($comment->isDeletable($sf_user->getMemberId())) {
?>
[<?php
echo link_to(__('Delete'), '@communityTopic_comment_delete_confirm?id=' . $comment->getId());
?>
]
<?php
}
?>
<br>
<?php
echo op_community_topic_link_to_member($comment->getMember());
?>
<br>
<?php
echo op_auto_link_text_for_mobile(nl2br($comment->getBody()));
?>
<?php
if (count($comment->getImages())) {
?>
<br>
<?php
foreach ($comment->getImages() as $image) {
?>
<br><?php
echo link_to(__('Image %number%', array('%number%' => $image->getNumber())), sf_image_path($image->File, array('size' => '240x320', 'f' => 'jpg')));
}
}
示例12: op_mobile_page_title
<?php
op_mobile_page_title(__('Settings'), __('Delete Photo'));
echo __('Do you delete this photo?');
?>
<hr color="<?php
echo $op_color["core_color_12"];
?>
">
<center>
<?php
echo op_image_tag_sf_image($community->getImageFileName(), array('size' => '120x120', 'format' => 'jpg'));
?>
<br>
<?php
echo sprintf('[%s]', link_to(__('Expansion'), sf_image_path($community->getImageFileName(), array('size' => opConfig::get('mobile_image_max_size'), 'format' => 'jpg'))));
?>
<br>
</center>
<hr color="<?php
echo $op_color["core_color_12"];
?>
">
<?php
op_include_form('deleteForm', $form, array('url' => url_for('@community_deleteImage?id=' . $id), 'button' => __('Delete'), 'align' => 'center'));
示例13: createEntryByInstance
public function createEntryByInstance(Doctrine_Record $member, SimpleXMLElement $entry = null)
{
$entry = parent::createEntryByInstance($member, $entry);
sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'opUtil', 'sfImage', 'Asset', 'Tag'));
$entry->setTitle($member->getName());
if (!$this->member || $member->id === $this->member->id) {
$entry->setAuthor(null, null, $member->getEmailAddress());
}
$content = $entry->getElements()->addChild('content');
$content->addAttribute('type', 'xhtml');
$profiles = $content->addChild('div');
$profiles->addAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
$ids = array();
foreach ($member->getProfiles() as $profile) {
if (in_array($profile->getName(), $ids)) {
continue;
}
if ($this->member && !$profile->isAllowed($this->member, 'view')) {
continue;
}
$ids[] = $profile->getName();
if ($profile->getProfile()->isPreset()) {
$i18n = sfContext::getInstance()->getI18N();
$child = $profiles->addChild('div');
$entry->addValidStringToNode($child, $i18n->__((string) $profile));
} else {
$child = $profiles->addChild('div');
$entry->addValidStringToNode($child, $profile);
}
$child->addAttribute('id', $profile->getName());
}
$entry->setLink(url_for('@feeds_member_retrieve_resource_normal?model=member&id=' . $member->getId()), 'self', 'application/atom+xml');
$entry->setLink(app_url_for('pc_frontend', 'member/profile?id=' . $member->getId(), true), 'alternate', 'text/html');
$entry->setLink(app_url_for('mobile_frontend', 'member/profile?id=' . $member->getId(), true), 'alternate');
$image = $member->getImage();
if ($image) {
$entry->setLink(sf_image_path($member->getImageFileName(), array(), true), 'enclosure', $member->getImage()->getFile()->getType());
}
return $entry;
}
示例14: executeListMention
public function executeListMention(sfWebRequest $request)
{
sfContext::getInstance()->getConfiguration()->loadHelpers(array('Helper', 'Date', 'sfImage', 'opUtil', 'Escaping'));
$baseUrl = sfConfig::get('op_base_url');
$memberId = $this->getUser()->getMember()->getId();
$mines = Doctrine::getTable('ActivityData')->findByMemberId($memberId);
$replyId = array();
foreach ($mines as $mine) {
$replyId[] = $mine->getId();
}
$activityData = Doctrine_Query::create()->from('ActivityData ad')->where('ad.template = ?', 'mention_member_id')->andWhere('ad.template_param LIKE ?', '%|' . $memberId . '|%')->execute();
foreach ($activityData as $activity) {
$id = $activity->getId();
$memberId = $activity->getMemberId();
$member = Doctrine::getTable('Member')->find($memberId);
if (!$member->getImageFileName()) {
$memberImage = $baseUrl . '/images/no_image.gif';
} else {
$memberImageFile = $member->getImageFileName();
$memberImage = sf_image_path($memberImageFile, array('size' => '48x48'));
}
$memberName = $member->getName();
$memberScreenName = $this->getScreenName($memberId) ? $this->getScreenName($memberId) : $memberName;
$body = sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), opTimelinePluginUtil::screenNameReplace($activity->getBody(), $baseUrl));
$uri = $activity->getUri();
$source = $activity->getSource();
$sourceUri = $activity->getSourceUri();
$createdAt = $activity->getCreatedAt();
if ($memberId == $this->getUser()->getMember()->getId()) {
$deleteLink = 'show';
} else {
$deleteLink = 'none';
}
$ac[] = array('id' => $id, 'memberId' => $memberId, 'memberImage' => $memberImage, 'memberScreenName' => $memberScreenName, 'memberName' => $memberName, 'body' => $body, 'deleteLink' => $deleteLink, 'uri' => $uri, 'source' => $source, 'sourceUri' => $sourceUri, 'createdAt' => op_format_activity_time(strtotime($createdAt)), 'baseUrl' => sfConfig::get('op_base_url'));
}
$json = array('status' => 'success', 'data' => $ac);
return $this->renderText(json_encode($json));
}
示例15: array
<?php
$imgParam = array('size' => '180x180', 'alt' => '');
?>
<h2><?php
echo __('Modify a banner image');
?>
</h2>
<form action="" method="post" enctype="multipart/form-data">
<table><tbody>
<tr>
<td style="text-align: center" colspan="2">
<?php
echo link_to(image_tag_sf_image($form->getObject()->getFile(), $imgParam), sf_image_path($form->getObject()->getFile()));
?>
</td>
</tr>
<?php
echo $form;
?>
<tr>
<td colspan="2"><input type="submit" value="<?php
echo __('Modify');
?>
" /></td>
</tr>
</tbody></table>
</form>