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


PHP Thumbnail::show方法代码示例

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


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

示例1: thumbnail

 function thumbnail($filename, $width = 640, $height = 480)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $source = "/media/com_arcnaanimals/{$filename}";
     if (!JFile::exists(JPATH_ROOT . $source)) {
         return false;
     }
     $destination = "/media/com_arcnaanimals/thumbs/{$width}_{$height}_{$filename}";
     if (!JFile::exists(JPATH_ROOT . $destination)) {
         if (!JFolder::exists(dirname(JPATH_ROOT . $destination))) {
             JFolder::create(dirname(JPATH_ROOT . $destination));
         }
         require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/thumbnail/Thumbnail.class.php';
         $thumb = new Thumbnail(JPATH_ROOT . $source);
         // Contructor and set source image file
         $thumb->size($width, $height);
         // [OPTIONAL] set the biggest width and height for thumbnail
         $thumb->process();
         // generate image
         // save the file
         ob_start();
         $thumb->show();
         $output = ob_get_contents();
         ob_end_clean();
         JFile::write(JPATH_ROOT . $destination, $output);
     }
     $url = JURI::root(true) . $destination;
     return "<img src='{$url}' alt='{$filename}'/>";
 }
开发者ID:snellcode,项目名称:ARCNA-Animals,代码行数:30,代码来源:arcna.php

示例2:

$thumb->allow_enlarge=false;              // [OPTIONAL] allow to enlarge the thumbnail
//$thumb->CalculateQFactor(10000);          // [OPTIONAL] Calculate JPEG quality factor for a specific size in bytes
//$thumb->bicubic_resample=false;             // [OPTIONAL] set resample algorithm to bicubic
*/
$thumb->img_watermark = 'watermark.png';
// [OPTIONAL] set watermark source file, only PNG format [RECOMENDED ONLY WITH GD 2 ]
/*
$thumb->img_watermark_Valing='TOP';   	    // [OPTIONAL] set watermark vertical position, TOP | CENTER | BOTTON
$thumb->img_watermark_Haling='LEFT';   	    // [OPTIONAL] set watermark horizonatal position, LEFT | CENTER | RIGHT

$thumb->txt_watermark='Watermark Text';	    // [OPTIONAL] set watermark text [RECOMENDED ONLY WITH GD 2 ]
$thumb->txt_watermark_color='FF0000';	    // [OPTIONAL] set watermark text color , RGB Hexadecimal[RECOMENDED ONLY WITH GD 2 ]
$thumb->txt_watermark_font=5;	            // [OPTIONAL] set watermark text font: 1,2,3,4,5
$thumb->txt_watermark_Valing='BOTTOM';   	// [OPTIONAL] set watermark text vertical position, TOP | CENTER | BOTTOM
$thumb->txt_watermark_Haling='RIGHT';       // [OPTIONAL] set watermark text horizonatal position, LEFT | CENTER | RIGHT
$thumb->txt_watermark_Hmargin=10;           // [OPTIONAL] set watermark text horizonatal margin in pixels
$thumb->txt_watermark_Vmargin=10;           // [OPTIONAL] set watermark text vertical margin in pixels

$thumb->size_width(150);				    // [OPTIONAL] set width for thumbnail, or
$thumb->size_height(113);				    // [OPTIONAL] set height for thumbnail, or
$thumb->size_auto(150);					    // [OPTIONAL] set the biggest width or height for thumbnail
*/
$thumb->size(150, 113);
// [OPTIONAL] set the biggest width and height for thumbnail
$thumb->process();
// generate image
$thumb->show();
// show your thumbnail, or
//$thumb->save("thumbnail.".$thumb->output_format);			// save your thumbnail to file, or
//$image = $thumb->dump();                  // get the image
//echo ($thumb->error_msg);                 // print Error Mensage
开发者ID:ctiborv,项目名称:spitzen-wein.ch,代码行数:31,代码来源:Thumbnail_sample.php

示例3: update

 public static function update($values, $user)
 {
     $id = $values['id'];
     if ($id) {
         $q = new Doctrine_Query();
         $q = $q->select('t.*')->from('Theme t');
         $q = $q->addWhere('id = ?', array($id));
         if (!$user->getRole() == User::ADMIN) {
             $q = $q->addWhere('user_id = ?', array($user->getId()));
         }
         $theme = $q->fetchOne();
     } else {
         $theme = new Theme();
     }
     if ($theme) {
         $theme->setName($values['name']);
         $theme->setDescription($values['description']);
         if (!$theme->getUserId()) {
             $theme->setUserId($user->getId());
         }
         $file = $values['file'];
         if ($file) {
             $filename = $file->getOriginalName();
             $theme->setFileName($filename);
         }
         $theme->setApproved(false);
         $theme->save();
         $folderpath = $theme->getFolderPath();
         if (!is_dir($folderpath)) {
             mkdir($folderpath);
         }
         if ($file) {
             $filepath = $folderpath . $theme->getFileName();
             $file->save($filepath);
         }
         $screenshot = $values['screenshot'];
         if ($screenshot) {
             $screenshotpath = $folderpath . $theme->getId() . $screenshot->getOriginalName();
             $screenshot->save($screenshotpath);
             $smallThumb = new Thumbnail($screenshotpath);
             if ($smallThumb->getCurrentWidth() > 150 || $smallThumb->getCurrentHeight() > 150) {
                 $smallThumb->resize(150, 150);
             }
             $smallThumb->show(100, $folderpath . 'smallthumb.png');
             $bigThumb = new Thumbnail($screenshotpath);
             if ($bigThumb->getCurrentWidth() > 500 || $bigThumb->getCurrentHeight() > 500) {
                 $bigThumb->resize(500, 500);
             }
             $bigThumb->show(100, $folderpath . 'bigthumb.png');
             $screenshot = new Thumbnail($screenshotpath);
             $screenshot->show(100, $folderpath . 'screenshot.png');
             unlink($screenshotpath);
         }
         $outputs = array();
         if ($file) {
             exec(Tools::get('edje_list_path') . ' ' . $filepath, $outputs);
             $groups = array_splice($outputs, 4);
             $groups = array_keys(array_flip($groups));
             $name = substr($outputs[0], 6);
             if ($name) {
                 $theme->setName($name);
             }
             $author = substr($outputs[1], 8);
             if ($author) {
                 $theme->setAuthor($author);
             }
             $license = substr($outputs[2], 9);
             $theme->setLicense($license);
             $version = substr($outputs[3], 9);
             $theme->setVersion($version);
             $theme->save();
             $theme->clearThemeGroups();
             foreach ($groups as $group) {
                 $theme->addThemeGroup($group);
             }
         }
         return $theme;
     }
     return null;
 }
开发者ID:amitesh-singh,项目名称:Enlightenment,代码行数:80,代码来源:Theme.class.php

示例4: update

 public static function update($values, $user)
 {
     $id = $values['id'];
     if ($id) {
         $q = new Doctrine_Query();
         $q = $q->select('m.*')->from('Madule m');
         $q = $q->addWhere('id = ?', array($id));
         if (!$user->getRole() == User::ADMIN) {
             $q = $q->addWhere('user_id = ?', array($user->getId()));
         }
         $module = $q->fetchOne();
     } else {
         $module = new Madule();
     }
     if ($module) {
         $module->setName($values['name']);
         $module->setDescription($values['description']);
         $module->setSourceUrl($values['source_url']);
         if (!$module->getUserId()) {
             $module->setUserId($user->getId());
         }
         $module->setApplicationId($values['application_id']);
         $module->setApproved(false);
         $module->save();
         $folderpath = $module->getFolderPath();
         if (!is_dir($folderpath)) {
             mkdir($folderpath);
         }
         $screenshot = $values['screenshot'];
         if ($screenshot) {
             $screenshotpath = $folderpath . $module->getId() . $screenshot->getOriginalName();
             $screenshot->save($screenshotpath);
             $smallThumb = new Thumbnail($screenshotpath);
             if ($smallThumb->getCurrentWidth() > 150 || $smallThumb->getCurrentHeight() > 150) {
                 $smallThumb->resize(150, 150);
             }
             $smallThumb->show(100, $folderpath . 'smallthumb.png');
             $bigThumb = new Thumbnail($screenshotpath);
             if ($bigThumb->getCurrentWidth() > 500 || $bigThumb->getCurrentHeight() > 500) {
                 $bigThumb->resize(500, 500);
             }
             $bigThumb->show(100, $folderpath . 'bigthumb.png');
             $screenshot = new Thumbnail($screenshotpath);
             $screenshot->show(100, $folderpath . 'screenshot.png');
             unlink($screenshotpath);
         }
         return $module;
     }
     return null;
 }
开发者ID:amitesh-singh,项目名称:Enlightenment,代码行数:50,代码来源:Madule.class.php

示例5: thumb

 function thumb()
 {
     global $registrant_avatar_width, $registrant_avatar_height;
     ob_clean();
     include JPATH_SITE . "/components/com_dtregister/lib/thumbnail.inc.php";
     $registrant_avatar_width = JRequest::getVar('w', $registrant_avatar_width);
     $registrant_avatar_height = JRequest::getVar('h', $registrant_avatar_height);
     $thumb = new Thumbnail($_GET['filename']);
     $thumb->resize($registrant_avatar_width, $registrant_avatar_height);
     $thumb->show();
     exit;
 }
开发者ID:reeleis,项目名称:ohiocitycycles,代码行数:12,代码来源:file.php

示例6: showImage

 function showImage($filePath, $width, $height)
 {
     //echo $filePath;die;
     App::import('Vendor', 'Thumbnail', array('file' => 'thumbnail.inc.php'));
     /* ERROR Image */
     if (!file($filePath)) {
         $filePath = URL_SITE . '/img/noimage.png';
         $size = getimagesize($filePath);
         if (empty($width)) {
             $width = $size[0];
         }
     }
     /* End of error image */
     $thumb = new Thumbnail($filePath);
     $size = getimagesize($filePath);
     /* width and height setting and resize width and height with respect to image width and height  */
     if (!empty($width)) {
         if ($size[0] > $width) {
             $width = $width;
         } else {
             $width = $size[0];
         }
     }
     if (!empty($height)) {
         if ($size[1] > $height) {
             $height = $height;
         } else {
             $height = $size[0];
         }
     }
     //echo $width.'/'.$height;die;
     /* end of setting */
     //check to see if file exists
     //$thumb->resize($width,$height);
     echo $thumb->show();
     exit;
     //$thumb->crop(110,120,$width,$height);
     if (isset($filePath)) {
         $thumb->show();
         exit;
     } else {
         $thumb->destruct();
         exit;
     }
 }
开发者ID:praveensingh25000,项目名称:Bivid,代码行数:45,代码来源:CommonHelper.php


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