本文整理汇总了PHP中image::able方法的典型用法代码示例。如果您正苦于以下问题:PHP image::able方法的具体用法?PHP image::able怎么用?PHP image::able使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::able方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHtml
function getHtml($Recipient = null, $ZendMail = null)
{
$html = $this->html;
$data = $Recipient ? unserialize($Recipient->data) : array();
qg::fire('mail::gethtml', array('Mail' => $this, 'Recipient' => $Recipient, 'html' => &$html, 'data' => &$data, 'ZendMail' => $ZendMail));
if ($data) {
$T = new template($data);
$html = $T->renderMarker($html);
}
if ($ZendMail) {
// deprecated
preg_match_all("#<img.*?src=['\"]file://([^'\"]+)#i", $html, $matches);
$matches = array_unique($matches[1]);
if ($matches) {
$ZendMail->setType(Zend_Mime::MULTIPART_RELATED);
foreach ($matches as $key => $filename) {
if (!is_readable($filename) || !image::able($filename)) {
continue;
}
$at = $ZendMail->createAttachment(file_get_contents($filename));
$at->type = extensionToMime(preg_replace('/.*\\.([^.]+$)/', '$1', $filename));
$at->disposition = Zend_Mime::DISPOSITION_INLINE;
$at->id = 'i' . md5_file($filename);
$html = str_replace('file://' . $filename, 'cid:' . $at->id, $html);
trigger_error('error: auto inline images are deprecated!');
}
}
}
return $html;
}
示例2: foreach
$separator = $separator ? $separator : ' - ';
$previewImage = $Cont->SET['preview image']->setType('bool')->v;
if ($previewImage) {
$previewImageQuery = $Cont->SET->make('preview image query', '/w-120/h-400/max/')->v;
}
foreach ($res as $id => $r) {
$C = Page($id);
$P = $C->Page;
$href = $C->url();
?>
<div class=-item>
<?php
if ($previewImage) {
foreach ($C->Files() as $F) {
if (!image::able($F->path)) {
continue;
}
echo '<a href="' . $href . '"><img src="' . $F->url() . '/' . $previewImageQuery . '/' . $F->name() . '"></a>';
break;
}
}
?>
<a href="<?php
echo $href;
?>
" class=-title><?php
echo (string) $C->Title() ? $C->Title() : $P->Title();
?>
</a>