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


PHP Image::createThumb方法代码示例

本文整理汇总了PHP中Image::createThumb方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::createThumb方法的具体用法?PHP Image::createThumb怎么用?PHP Image::createThumb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Image的用法示例。


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

示例1: getImage

function getImage($image)
{
    if ($image) {
        $thumbImage = new Image(Yii::getPathOfAlias('webroot') . '/' . $image);
        $img_url = $thumbImage->createThumb(110, 70);
        return CHtml::image($img_url);
    }
}
开发者ID:ngdvan,项目名称:lntguitar,代码行数:8,代码来源:admin.php

示例2: showImage

function showImage($model)
{
    if (isset($model->image) && $model->image) {
        $thumbImage = new Image(Yii::getPathOfAlias('webroot') . '/' . $model->image);
        $img_url = $thumbImage->createThumb(110, 70);
        echo CHtml::image($img_url);
    }
}
开发者ID:ngdvan,项目名称:lntguitar,代码行数:8,代码来源:admin.php

示例3: getImgThumb

function getImgThumb($item)
{
    $path = Yii::getPathOfAlias('webroot') . $item['image'];
    if (file_exists($path)) {
        $img = new Image($path);
        return $img->createThumb(105, 70);
    } else {
        return Lnt::getYoutubeImage($item['link_youtube']);
    }
}
开发者ID:ngdvan,项目名称:lntguitar,代码行数:10,代码来源:view.php

示例4: image

 function image($conf, $multi = false)
 {
     $conf = $conf + ['dir' => '', 'key' => 'image', 'rename' => false, 'width' => false, 'height' => false, 'multi' => false, 'extensions' => Image::$extensions, 'conversion' => null];
     extract($conf);
     $func = 'file' . ($multi ? 's' : '');
     $dir = rtrim($dir, '/') . '/';
     return $this->{$func}($dir, $key, 'image/', function ($file) use($width, $height, $rename, $conversion) {
         $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
         if ($conversion && $ext != $conversion && ($imgFormat = exif_imagetype($file)) != constant('IMAGETYPE_' . strtoupper($conversion))) {
             switch ($imgFormat) {
                 case IMAGETYPE_GIF:
                     $img = imagecreatefromgif($file);
                     break;
                 case IMAGETYPE_JPEG:
                     $img = imagecreatefromjpeg($file);
                     break;
                 case IMAGETYPE_PNG:
                     $img = imagecreatefrompng($file);
                     break;
                 default:
                     throw new UploadException('image format conversion not supported');
                     break;
             }
             $oldFile = $file;
             $file = substr($file, 0, -1 * strlen($ext)) . $conversion;
             $ext = $conversion;
             $convertF = 'image' . $conversion;
             $convertF($img, $file);
             unlink($oldFile);
         }
         if ($rename) {
             if ($rename === true) {
                 $rename = 'image';
             }
             $rename = $this->formatFilename($rename);
             rename($file, dirname($file) . '/' . $rename . '.' . $ext);
         }
         if (($width || $height) && in_array($ext, Image::$extensions_resizable)) {
             $thumb = dirname($file) . '/' . pathinfo($file, PATHINFO_FILENAME) . '.' . $width . 'x' . $height . '.' . $ext;
             Image::createThumb($file, $thumb, $width, $height, 100, true);
         }
     }, function ($file) use($extensions) {
         $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
         if (!in_array($ext, (array) $extensions)) {
             throw new UploadException('extension');
         }
     });
 }
开发者ID:redcatphp,项目名称:framework,代码行数:48,代码来源:Uploader.php

示例5: renderContent

 public function renderContent()
 {
     $criteria1 = new CDbCriteria(array('condition' => 'status=1'));
     $all = (int) Teacher::model()->count($criteria1);
     if ($all > 5) {
         $offset = rand(0, $all - 5);
     } else {
         $offset = rand(0, $all);
     }
     $criteria = new CDbCriteria(array('condition' => 'status=1', 'order' => 'RAND()', 'limit' => '5,' . $offset));
     //echo $all;
     $teachers = Teacher::model()->findAll($criteria);
     if ($teachers) {
         echo CHtml::openTag("ul");
         foreach ($teachers as $teacher) {
             $img = '';
             if ($teacher->picture) {
                 Yii::import('application.extensions.image.Image');
                 $thumbImage = new Image(Yii::getPathOfAlias('webroot') . $teacher->picture);
                 $img_url = $thumbImage->createThumb(70, 60);
                 /*$thumbImage->resize(70, 60, Image::WIDTH);
                   $arr = explode("/",$teacher->picture);
                   $file_name = $arr[count($arr)-1];
                   $thumb = Yii::getPathOfAlias('webroot') . '/resources/images/85x72/' . $file_name;
                   $thumbImage->save($thumb);*/
                 $img = '<img src="' . $img_url . '" />';
             }
             echo CHtml::openTag("li", array('class' => 'clearfix'));
             echo CHtml::openTag("div", array('class' => 'avatar'));
             echo CHtml::link($img, Yii::app()->createUrl('/teacher/view', array('id' => $teacher->id, 'title' => Lnt::safeTitle($teacher->name))));
             echo "<div>Giảng viên</div>";
             echo CHtml::closeTag("div");
             echo CHtml::openTag("div", array('class' => 'title'));
             echo CHtml::link($teacher->name, Yii::app()->createUrl('/teacher/view', array('id' => $teacher->id, 'title' => Lnt::safeTitle($teacher->name))));
             echo CHtml::closeTag("div");
             echo CHtml::openTag("div", array('style' => 'margin-top:10px;float:left;width:80px;height:14px;background:#ce1f46;color:#fff;padding:8px 0px;text-align:center'));
             echo "5.1232";
             echo CHtml::closeTag("div");
             echo CHtml::openTag("div", array('style' => 'float:right;text-align:left;width:127px;margin-top:10px;font-weight:bold;color:#a8a8a8;'));
             echo $teacher->videoCount . " bài giảng | " . $teacher->likeTeachersCount . " " . CHtml::ajaxLink(CHtml::image(Yii::app()->baseUrl . '/images/tim_03.jpg', 'Like', array('title' => 'Yêu thích')), Yii::app()->createUrl('/teacher/like', array('id' => $teacher->id)), array('success' => 'js:function(res){alert(res.msg);}'), array('class' => 'teacher_like'));
             echo CHtml::closeTag("div");
             echo CHtml::closeTag("li");
         }
         echo CHtml::closeTag("ul");
     }
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:46,代码来源:BoxTeacher.php

示例6: handleUpload

 public static function handleUpload($file, $path, $nameWithoutExtension, $thumbWidth = null)
 {
     $old = umask(0);
     if (!is_dir($path)) {
         mkdir($path, 0777, true);
         $exploded = explode('/', rtrim('/', $path));
         $length = count($exploded) - 1;
         for ($i = 0; $i < $length; $i++) {
             array_pop($exploded);
             //pop off the last one every time. First one was already set so works perfectly.
             $chmod_path = implode('/', $exploded);
             chmod($chmod_path, 0777);
         }
     }
     umask($old);
     $extension = self::getExtension($file['name']);
     $destination = $path . $nameWithoutExtension . '.' . $extension;
     move_uploaded_file($file['tmp_name'], $destination);
     if ($thumbWidth) {
         Image::createThumb($destination, 100);
     }
     return $destination;
 }
开发者ID:quintenvk,项目名称:quintenvk,代码行数:23,代码来源:File.php

示例7: Image

echo $form->labelEx($model, 'image');
?>
        <?php 
//echo $form->textField($model, 'file_path', array('maxlength' => 255));
echo $form->fileField($model, 'image');
?>
        <?php 
echo $form->error($model, 'image');
?>
        <div id="image_box">
            <?php 
$imagPath = Yii::getPathOfAlias('webroot') . '/' . $model->image;
//var_dump($imagPath);die;
if (file_exists($imagPath) && is_file($imagPath)) {
    $thumbImage = new Image($imagPath);
    $img_url = $thumbImage->createThumb(110, 70);
    echo CHtml::image($img_url, $model->title, array('id' => 'image'));
    echo CHtml::ajaxButton('Xóa', $this->createUrl('delImage', array('id' => $model->id)), array('success' => 'js:function(){$("#image_box").remove()}'));
}
?>
        </div>
    </div>
    <!-- row -->
    <div class="row">
        <?php 
echo $form->labelEx($model, 'body');
?>
        <?php 
//echo $form->textArea($model, 'body');
/*$this->widget('application.extensions.cleditor.ECLEditor', array(
      'model' => $model,
开发者ID:ngdvan,项目名称:lntguitar,代码行数:31,代码来源:_form.php

示例8: foreach

 ?>
 <ul class="banchay">
     <?php 
 Yii::import('application.extensions.image.Image');
 $i = 1;
 foreach ($items as $item) {
     $class = 'item';
     if ($i == 1 | $i % 4 == 1) {
         $class .= ' first';
     } elseif ($i % 4 == 0) {
         $class .= ' last';
     }
     $i++;
     //var_dump($item);die;
     $thumb = new Image(Yii::getPathOfAlias('webroot') . $item['image']);
     $img_url = $thumb->createThumb(140, 195);
     echo CHtml::openTag("li", array('class' => $class));
     echo CHtml::link(CHtml::image($img_url), $this->createUrl('view', array('id' => $item['id'], 'title' => Lnt::safeTitle($item['title']))));
     echo CHtml::openTag("div", array('class' => 'title'));
     echo CHtml::encode($item['title']);
     echo CHtml::closeTag("div");
     echo CHtml::openTag("div", array('class' => 'price'));
     echo CHtml::encode(number_format($item['price'], 0, ',', '.') . 'đ');
     echo CHtml::closeTag("div");
     echo CHtml::openTag("div", array('class' => 'body'));
     echo Lnt::limitWord($item['body'], 10, ',', '.');
     echo CHtml::closeTag("div");
     echo CHtml::closeTag("li");
 }
 ?>
 </ul>
开发者ID:ngdvan,项目名称:lntguitar,代码行数:31,代码来源:index.php

示例9: createImage

 static function createImage($image, $width, $height)
 {
     if (!class_exists('Image', false)) {
         Yii::import('application.extensions.image.Image');
     }
     $path = Yii::getPathOfAlias('webroot') . $image;
     if (!is_file($path)) {
         $path = Yii::getPathOfAlias('webroot') . '/guitar.jpg';
     }
     $img = new Image($path);
     return $img->createThumb($width, $height);
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:12,代码来源:Lnt.php

示例10: getPrimaryImage

 private function getPrimaryImage($xml, $isPerson)
 {
     global $wgServer, $wgStylePath;
     foreach ($xml->image as $image) {
         if ($image['primary'] == 'true') {
             $t = Title::makeTitle(NS_IMAGE, (string) $image['filename']);
             if ($t && $t->exists()) {
                 $image = new Image($t);
                 $thumbURL = $wgServer . $image->createThumb(SearchForm::THUMB_WIDTH, SearchForm::THUMB_HEIGHT);
                 //               if ($isPerson) {
                 //                  $iconURL = $wgServer.$image->createThumb(TreeData::PERSON_ICON_WIDTH, TreeData::PERSON_ICON_HEIGHT);
                 //               }
                 //               else {
                 //                  $iconURL = '';
                 //               }
                 return $thumbURL;
             }
         }
     }
     if ($isPerson) {
         return $wgServer . $wgStylePath . ((string) $xml->gender == 'F' ? TreeData::WOMAN_THUMB : TreeData::MAN_THUMB);
     } else {
         return '';
     }
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:25,代码来源:GetTreeData.php

示例11: Image

     }
 } else {
     //货号不存在,自动增长货号
     $goodsinfo['g_sn'] = $goods->createAutoSn();
 }
 //接收图片并处理,不管图片是否上传成功,都不会影响整个商品记录的插入
 //var_dump($_FILES);exit;
 if ($path = Upload::uploadSingle($_FILES['goods_img'], $config['goods_img_upload'], $config['goods_img_upload_max'])) {
     //上传成功,将上传文件的相对路径存放到数据对应的字段下
     $goodsinfo['g_img'] = $path;
 } else {
     //上传失败,获取错误信息
     $error = Upload::$errorInfo;
 }
 $image = new Image();
 if ($thumb_path = $image->createThumb($goodsinfo['g_img'])) {
     //成功
     $goodsinfo['g_thumb_img'] = $thumb_path;
 }
 //插入到数据库
 if ($goods->insertGoods($goodsinfo)) {
     //插入成功
     //需要判断文件上传情况
     if (isset($error)) {
         //文件上传失败
         admin_redirect('goods.php?act=list', '新增商品成功!但是文件上传失败,失败原因是:' . $error, 2);
     } else {
         //文件上传成功
         admin_redirect('goods.php?act=list', '新增商品成功!', 2);
     }
 } else {
开发者ID:lushizijizoude,项目名称:phpstarty,代码行数:31,代码来源:goods.php

示例12: toWikiText

    /**
     * Create wiki text from xml property
     */
    protected function toWikiText($parser)
    {
        //        wfDebug("toWikiText=" . $this->xml->asXML() . "\n");
        global $wgESINHandler, $wgOut;
        $result = '';
        if (isset($this->xml)) {
            // check rename needed
            if (!$this->isGedcomPage && mb_strpos($this->titleString, 'Unknown') !== false) {
                $correctTitle = StructuredData::constructName(@$this->xml->name['given'], @$this->xml->name['surname']);
                if (Person::isRenameNeeded($this->titleString, $correctTitle)) {
                    $t = Title::makeTitle(NS_SPECIAL, 'Movepage');
                    $url = $t->getLocalURL('target=' . $this->title->getPrefixedURL() . '&wpNewTitle=' . wfUrlencode("Person:{$correctTitle}") . '&wpReason=' . wfUrlencode('make page title agree with name'));
                    $parser->mOutput->mSubtitle = 'This page can be <a href="' . $url . '">renamed</a>';
                    $wgOut->setSubtitle($parser->mOutput->mSubtitle);
                }
            }
            // add infoboxes
            $gender = (string) $this->xml->gender;
            switch ($gender) {
                case 'M':
                    $genderClass = '-male';
                    break;
                case 'F':
                    $genderClass = '-female';
                    break;
                default:
                    $genderClass = '';
            }
            $image = $wgESINHandler->getPrimaryImage($this->xml);
            $imageText = "<div class=\"wr-infobox-noimage{$genderClass}\"></div>";
            $imageURL = '';
            if (isset($image)) {
                $thumbWidth = SearchForm::THUMB_WIDTH;
                $filename = (string) $image['filename'];
                $t = Title::makeTitle(NS_IMAGE, $filename);
                if ($t && $t->exists()) {
                    $img = new Image($t);
                    $caption = (string) $image['caption'];
                    if (!$caption) {
                        $caption = $filename;
                    }
                    $maxWidth = 700;
                    $maxHeight = 300;
                    $width = $img->getWidth();
                    $height = $img->getHeight();
                    if ($maxWidth > $width * $maxHeight / $height) {
                        $maxWidth = wfFitBoxWidth($width, $height, $maxHeight);
                    }
                    $imageURL = $img->createThumb($maxWidth, $maxHeight);
                    $caption = str_replace('|', ' ', $caption);
                    $titleAttr = StructuredData::escapeXml("{$imageURL}|{$maxWidth}|{$caption}");
                    $imageText = "<span class=\"wr-imagehover\" title=\"{$titleAttr}\">[[Image:{$filename}|{$thumbWidth}x{$thumbWidth}px]]</span>";
                }
            }
            $fullname = StructuredData::getFullname($this->xml->name);
            if (!$fullname) {
                $fullname = '&nbsp;';
            }
            $birthDate = $birthPlace = $deathDate = $deathPlace = '';
            $chrDate = $chrPlace = $burDate = $burPlace = '';
            $birthFound = $deathFound = $chrFound = $burFound = false;
            $birthSource = $deathSource = false;
            if (isset($this->xml->event_fact)) {
                foreach ($this->xml->event_fact as $eventFact) {
                    if ($eventFact['type'] == 'Birth') {
                        $birthFound = true;
                        $birthDate = (string) $eventFact['date'];
                        $birthPlace = (string) $eventFact['place'];
                        $birthSource = (string) $eventFact['sources'];
                    } else {
                        if ($eventFact['type'] == 'Christening' || $eventFact['type'] == 'Baptism') {
                            $chrFound = true;
                            $chrDate = (string) $eventFact['date'];
                            $chrPlace = (string) $eventFact['place'];
                        } else {
                            if ($eventFact['type'] == 'Death') {
                                $deathFound = true;
                                $deathDate = (string) $eventFact['date'];
                                $deathPlace = (string) $eventFact['place'];
                                $deathSource = (string) $eventFact['sources'];
                            } else {
                                if ($eventFact['type'] == 'Burial') {
                                    $burFound = true;
                                    $burDate = (string) $eventFact['date'];
                                    $burPlace = (string) $eventFact['place'];
                                }
                            }
                        }
                    }
                }
            }
            $this->initHistoricalDataPerson($fullname, $gender, $imageURL);
            $birthLabel = '&nbsp;';
            if ($birthFound) {
                $birthLabel = 'b.';
                $this->addHistoricalDataEvent('birth', $birthDate, $birthPlace);
            } else {
//.........这里部分代码省略.........
开发者ID:k-hasan-19,项目名称:wiki,代码行数:101,代码来源:Person.php

示例13: Image

        if ($product->image) {
            /*$thumb = '/upload/images/thumb/product100/'.substr_replace($product->image,'',0,14);
            		if(!is_file(Yii::getPathOfAlias('webroot').$thumb)){
            			Yii::import('application.extensions.image.Image');
            			$image = new Image(Yii::getPathOfAlias('webroot').'/'.$product->image);
            			$image->resize(100, 100);
            			if(!is_dir(Yii::getPathOfAlias('webroot').'/upload/images/thumb/product100/')){
            				mkdir(Yii::getPathOfAlias('webroot').'/upload/images/thumb/product100/');
            				chmod(Yii::getPathOfAlias('webroot').'/upload/images/thumb/product100/',0777);
            			}
            			$image->save(Yii::getPathOfAlias('webroot').$thumb);
            		}*/
        }
        $i++;
        $img = new Image(Yii::getPathOfAlias("webroot") . $product->image);
        $img_url = $img->createThumb(70, 70);
        echo "<tr><td>{$i}</td><td><div style='float:left;border: 1px solid #CCCCCC;padding:5px;margin-right:5px;'><a href='" . $this->createUrl('product/view', array('id' => $product->id, 'title' => Lnt::safeTitle($product->title))) . "' target='_blank'><img src='" . $img_url . "' /></a></div></td><td><div>{$product->title}</div></td><td><div style='text-align:center;color:#990000;font-weight: bold;'>" . number_format($product->price * $item['count'], 0, ',', '.') . " đ</div></td><td>" . CHtml::listBox('price', $item['count'], array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10), array('size' => 1, 'onchange' => 'updateCart(' . $product->id . ',this);')) . "</td><td>" . CHtml::ajaxLink('Xóa', $this->createUrl('remove', array('id' => $product->id)), array('success' => 'js:function(data){if(data.success){window.location.reload();}}')) . "</td></tr>";
    }
    ?>

		<tr><td colspan="3" ><?php 
    echo CHtml::link('', $this->createUrl('index'), array('id' => 'btnbackBuy'));
    ?>
<span style="float:right;font-weight: bold;">Tổng tiền:</span></td><td style="text-align:center;color:#990000;font-weight: bold;"><?php 
    echo number_format($total_price, 0, ',', '.');
    ?>
 đ</td><td colspan="2"><?php 
    echo CHtml::link("", $this->createUrl('pay'), array('id' => 'btnPay'));
    ?>
</td></tr>
		<?php 
开发者ID:ngdvan,项目名称:lntguitar,代码行数:31,代码来源:cart.php

示例14: getItems

 public function getItems()
 {
     global $wrIconSize;
     $result = '';
     $this->places = array();
     $this->externals = array();
     $this->otherEvents = array();
     $this->latlngs = array();
     foreach ($this->people as $titleText => $p) {
         $given = $surname = $fullname = '';
         $birthDate = $birthPlace = $birthPlaceText = $birthYear = '';
         $deathDate = $deathPlace = $deathPlaceText = $deathYear = '';
         $imageURL = $iconURL = '';
         $parents = $spouse = $allPlace = '';
         $otherEvents = '';
         $xml = $p['xml'];
         $position = $p['position'];
         $allPlaces = array();
         if ($xml) {
             foreach ($xml->name as $name) {
                 $given = (string) $name['given'];
                 $surname = (string) $name['surname'];
                 $fullname = StructuredData::getFullname($name);
                 break;
             }
             list($birthEventType, $birthDate, $birthPlace, $birthPlaceText, $birthYear) = $this->getEventData($xml, array('Birth', 'Christening', 'Baptism'));
             list($deathEventType, $deathDate, $deathPlace, $deathPlaceText, $deathYear) = $this->getEventData($xml, array('Death', 'Burial'));
             $otherEvents = $this->getOtherEventData($xml, array($birthEventType, $deathEventType));
             foreach ($xml->image as $image) {
                 if ($image['primary'] == 'true') {
                     $t = Title::makeTitle(NS_IMAGE, (string) $image['filename']);
                     if ($t && $t->exists()) {
                         $image = new Image($t);
                         $imageURL = $image->createThumb(SearchForm::THUMB_WIDTH);
                         $iconURL = $image->createThumb(PedigreeData::ICON_WIDTH, -1, true);
                         break;
                     }
                 }
             }
             $parents = $this->getTitles($xml, 'child_of_family', 'Family');
             $this->addExternals($parents);
             $spouse = $this->getTitles($xml, 'spouse_of_family', 'Family');
             $this->addExternals($spouse);
             $allPlaces = $this->getAllEventPlaces($xml);
             $this->addPlaces($allPlaces);
         }
         if (substr($position, 0, 1) == 'P') {
             $pos = substr($position, 1);
             $line = self::$LINES[$pos];
             $generation = self::$GENERATIONS[$pos];
         } else {
             if ($position == 'Spouse') {
                 $line = self::$LINES[1];
                 $generation = self::$GENERATIONS[1];
             } else {
                 // $position == 'Child'
                 $line = self::$LINES[0];
                 $generation = self::$GENERATIONS[0];
             }
         }
         $result .= ($result ? ",\n" : '') . '{ ' . PedigreeData::outJSON('type', 'Person') . PedigreeData::outJSON('label', 'Person:' . $titleText) . PedigreeData::outJSON('Surname', $surname) . PedigreeData::outJSON('Givenname', $given) . PedigreeData::outJSON('FullName', $fullname) . PedigreeData::outJSON('BirthYear', $birthYear) . PedigreeData::outJSON('BirthDate', $birthDate) . PedigreeData::outJSON('BirthPlace', $birthPlace) . PedigreeData::outJSON('BirthPlaceText', $birthPlaceText) . PedigreeData::outJSON('DeathYear', $deathYear) . PedigreeData::outJSON('DeathDate', $deathDate) . PedigreeData::outJSON('DeathPlace', $deathPlace) . PedigreeData::outJSON('DeathPlaceText', $deathPlaceText) . PedigreeData::outJSON('OtherEvents', $otherEvents) . PedigreeData::outJSON('ImageURL', $imageURL) . PedigreeData::outJSON('IconURL', $iconURL) . PedigreeData::outJSON('Parents', $parents) . PedigreeData::outJSON('Spouse', $spouse) . PedigreeData::outJSON('AllPlaces', $allPlaces) . PedigreeData::outJSON('Line', $line) . PedigreeData::outJSON('Generation', $generation) . PedigreeData::outJSON('Position', $position, false) . "}";
     }
     foreach ($this->families as $titleText => $p) {
         $marriageDate = $marriagePlace = $marriagePlaceText = $marriageYear = '';
         $husband = $wife = $children = '';
         $otherEvents = '';
         $xml = $p['xml'];
         $position = $p['position'];
         if ($xml) {
             list($marriageEventType, $marriageDate, $marriagePlace, $marriagePlaceText, $marriageYear) = $this->getEventData($xml, array('Marriage'));
             $otherEvents = $this->getOtherEventData($xml, array($marriageEventType));
             $husband = $this->getTitles($xml, 'husband', 'Person');
             $this->addExternals($husband);
             $wife = $this->getTitles($xml, 'wife', 'Person');
             $this->addExternals($wife);
             $children = $this->getTitles($xml, 'child', 'Person');
             $this->addExternals($children);
         }
         $result .= ($result ? ",\n" : '') . '{ ' . PedigreeData::outJSON('type', 'Family') . PedigreeData::outJSON('label', 'Family:' . $titleText) . PedigreeData::outJSON('MarriageYear', $marriageYear) . PedigreeData::outJSON('MarriageDate', $marriageDate) . PedigreeData::outJSON('MarriagePlace', $marriagePlace) . PedigreeData::outJSON('MarriagePlaceText', $marriagePlaceText) . PedigreeData::outJSON('OtherEvents', $otherEvents) . PedigreeData::outJSON('Husband', $husband) . PedigreeData::outJSON('Wife', $wife) . PedigreeData::outJSON('Child', $children) . PedigreeData::outJSON('Position', $position, false) . "}";
     }
     // add externals
     foreach ($this->externals as $titleText => $dummy) {
         $result .= ($result ? ",\n" : '') . '{ ' . PedigreeData::outJSON('type', 'External') . PedigreeData::outJSON('label', $titleText, false) . "}";
     }
     // add other events
     foreach ($this->otherEvents as $index => $event) {
         $result .= ($result ? ",\n" : '') . '{ ' . PedigreeData::outJSON('type', 'Event') . PedigreeData::outJSON('label', 'Event:' . ($index + 1)) . PedigreeData::outJSON('Date', $event['date']) . PedigreeData::outJSON('Place', $event['place']) . PedigreeData::outJSON('PlaceText', $event['placetext']) . PedigreeData::outJSON('EventType', $event['type'], false) . "}";
     }
     // add places
     $stdPlaces = PlaceSearcher::getPlaceTitlesLatLong($this->places);
     foreach ($stdPlaces as $titleText => $stdPlace) {
         if ($stdPlace['lat'] || $stdPlace['lon']) {
             $result .= ($result ? ",\n" : '') . '{ ' . PedigreeData::outJSON('type', 'Place') . PedigreeData::outJSON('label', 'Place:' . $titleText) . PedigreeData::outJSON('addressLatLng', $stdPlace['lat'] . ',' . $stdPlace['lon'], false) . "}";
         }
     }
     foreach ($this->latlngs as $latlng) {
         $result .= ($result ? ",\n" : '') . '{ ' . PedigreeData::outJSON('type', 'LatLng') . PedigreeData::outJSON('label', 'LatLng:' . $latlng) . PedigreeData::outJSON('addressLatLng', $latlng, false) . "}";
     }
     return $result;
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:100,代码来源:GetPedigreeData.php

示例15: getImageInfo

    protected function getImageInfo($image, $firstChildClass = '')
    {
        $imageText = '';
        $thumbWidth = SearchForm::THUMB_WIDTH;
        $filename = (string) $image['filename'];
        $t = Title::makeTitle(NS_IMAGE, $filename);
        if ($t && $t->exists()) {
            $img = new Image($t);
            $caption = (string) $image['caption'];
            if (!$caption) {
                $caption = $filename;
            }
            $maxWidth = 700;
            $maxHeight = 300;
            $width = $img->getWidth();
            $height = $img->getHeight();
            if ($maxWidth > $width * $maxHeight / $height) {
                $maxWidth = wfFitBoxWidth($width, $height, $maxHeight);
            }
            $imageURL = $img->createThumb($maxWidth, $maxHeight);
            $caption = str_replace('|', ' ', $caption);
            $titleAttr = StructuredData::escapeXml("{$imageURL}|{$maxWidth}|{$caption}");
            $imageText = <<<END
<td style="width: 1%" class="{$firstChildClass}">
   <div class="wr-infobox-image wr-imagehover" title="{$titleAttr}">[[Image:{$filename}|{$thumbWidth}x{$thumbWidth}px]]</div>
</td>
END;
        }
        return $imageText;
    }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:30,代码来源:Family.php


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