• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Thumbnail类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: attach_file

 public function attach_file($file, $campo)
 {
     global $database;
     // Determine the target_path
     $this->temp_path = $file['tmp_name'];
     switch ($file['type']) {
         case "image/gif":
             $this->foto = $campo . "-" . $this->id . ".gif";
             break;
         case "image/png":
             $this->foto = $campo . "-" . $this->id . ".png";
             break;
         default:
             $this->foto = $campo . "-" . $this->id . ".jpg";
     }
     $target_path = $this->upload_dir . "/" . $this->foto;
     // Attempt to move the file
     if (move_uploaded_file($this->temp_path, $target_path)) {
         // Success
         $tn_image = new Thumbnail($this->upload_dir . "/" . $this->foto, 640, 0, 0);
         $tn_image->save($this->upload_dir . "/" . $this->foto);
         // Save a corresponding entry to the database
         $sql = "UPDATE " . self::$table_name . " SET " . $campo . " = '" . $this->foto . "' WHERE id = '" . $this->id . "'";
         if ($database->query($sql)) {
             // We are done with temp_path, the file isn't there anymore
             unset($this->temp_path);
             return true;
         }
     }
 }
开发者ID:hugodom,项目名称:CamposEstancias,代码行数:30,代码来源:propiedades.php


示例2: createThumbnail

 /**
  * Creates and saves a thumbnail picture.
  */
 public function createThumbnail($thumbnailWidth = ATTACHMENT_THUMBNAIL_WIDTH, $thumbnailHeight = ATTACHMENT_THUMBNAIL_HEIGHT, $addSourceInfo = ATTACHMENT_THUMBNAIL_ADD_SOURCE_INFO, $useEmbedded = ATTACHMENT_THUMBNAIL_USE_EMBEDDED)
 {
     // make thumbnail
     $sourceFile = WCF_DIR . 'attachments/attachment-' . $this->attachmentID;
     $targetFile = WCF_DIR . 'attachments/thumbnail-' . $this->attachmentID;
     $thumbnail = new Thumbnail($sourceFile, $thumbnailWidth, $thumbnailHeight, $addSourceInfo, $this->attachmentName, $useEmbedded);
     // get thumbnail
     try {
         if ($thumbnailData = $thumbnail->makeThumbnail()) {
             // save thumbnail
             $file = new File($targetFile);
             $file->write($thumbnailData);
             unset($thumbnailData);
             $file->close();
             // update database entry
             $thumbnailSize = intval(filesize($targetFile));
             list($thumbnailWidth, $thumbnailHeight, ) = @getImagesize($targetFile);
             $sql = "UPDATE\twcf" . WCF_N . "_attachment\n\t\t\t\t\tSET \tthumbnailType = '" . escapeString($thumbnail->getMimeType()) . "',\n\t\t\t\t\t\tthumbnailSize = " . $thumbnailSize . ",\n\t\t\t\t\t\tthumbnailWidth = " . $thumbnailWidth . ",\n\t\t\t\t\t\tthumbnailHeight = " . $thumbnailHeight . "\n\t\t\t\t\tWHERE \tattachmentID = " . $this->attachmentID;
             WCF::getDB()->registerShutdownUpdate($sql);
             // update data
             $this->data['thumbnailType'] = $thumbnail->getMimeType();
             $this->data['thumbnailSize'] = $thumbnailSize;
         }
     } catch (Exception $e) {
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:29,代码来源:AttachmentEditor.class.php


示例3: handleDirFiles

function handleDirFiles($dir_name, $save_dir)
{
    list($directories, $files) = File_Find::maptree($dir_name);
    $new_dir = $save_dir . basename($dir_name);
    if (!file_exists($new_dir)) {
        mkdir($new_dir, 0777);
    }
    foreach ($files as $image_file) {
        if (ereg("(.*)jpg\$", $image_file)) {
            $new_filename = $new_dir . "/" . basename($image_file, ".jpg") . "_resize.jpg";
            echo $new_filename . "\n";
            $tn_image = new Thumbnail($image_file, 340);
            $tn_image->save($new_filename);
            $Canvas =& Image_Canvas::factory(isset($_GET['canvas']) ? $_GET['canvas'] : 'jpg', array('width' => 340, 'height' => 340));
            $Canvas->image(array('x' => 340, 'y' => 340, 'filename' => $new_filename, 'alignment' => array('horizontal' => 'right', 'vertical' => 'bottom')));
            $Canvas->setFont(array('name' => 'Courier New', 'size' => 16, 'color' => '#FF66FF'));
            //#FF0033
            $Canvas->addText(array('x' => 165, 'y' => 200, 'text' => 'arzen1013', 'alignment' => array('horizontal' => 'center', 'vertical' => 'bottom')));
            $Canvas->setFont(array('name' => 'Courier New', 'size' => 10, 'color' => '#000000'));
            //#FF0033
            $Canvas->addText(array('x' => 165, 'y' => 320, 'text' => 'http://shop33691629.taobao.com/', 'alignment' => array('horizontal' => 'center', 'vertical' => 'bottom')));
            $Canvas->save(array('filename' => $new_filename));
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:25,代码来源:image_join.php


示例4: 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


示例5: index

 public function index()
 {
     $u = new SwfUpload();
     $t = new Thumbnail();
     $u->files = $_FILES;
     //设置file数组。(只能单张)
     //请记住先检测,再上传
     $r = $u->check();
     if ($r === true && ($r = $u->upload())) {
         //            echo_log($r);
         if (!isset($r['error'])) {
             // 生成200的缩略图
             $t->setSrcImg($r['savePath']);
             $height = $t->getImgHeight();
             $width = $t->getImgWidth();
             if ($this->savePicture($r['saveName'], $r['title'], $width, $height)) {
                 // 生成小的缩略图
                 $t->setDstImg($r['savePath'] . '_' . THUMBNAIL_WIDTH_SMALL);
                 $t->createImg(THUMBNAIL_WIDTH_SMALL);
                 // 生成打的缩略图
                 $t->setSrcImg($r['savePath']);
                 $t->setDstImg($r['savePath'] . '_' . THUMBNAIL_WIDTH_LARGE);
                 $t->createImg(THUMBNAIL_WIDTH_LARGE);
                 $rt = array('thumbUrl' => $r['saveName'], 'title' => $r['title'], 'width' => $width, 'height' => $height);
                 json_success($rt);
             } else {
                 json_failure('图片信息入库异常');
             }
         } else {
             json_failure($r['error']);
         }
     } else {
         json_failure($r['error']);
     }
 }
开发者ID:bennylii,项目名称:waterfall,代码行数:35,代码来源:UploadAction.class.php


示例6: actionGenerate

 /**
  * Generates a thumbnail for the specified image path and size, then serves 
  * it to the browser. The next time the same thumbnail is rendered its URL 
  * will point to the generated image instead of this action.
  * @see Thumbnail
  * @param string $path the thumbnail path
  * @param int $size the thumbnail size
  * @throws PageNotFoundException if the image could not be generated
  */
 public function actionGenerate($path, $size)
 {
     $thumbnail = new Thumbnail($path, $size);
     $thumbnail->generate();
     $path = $thumbnail->getPath();
     if ($path === false) {
         throw new PageNotFoundException();
     }
     header('Content-Type: ' . CFileHelper::getMimeType($path));
     readfile($path);
     exit;
 }
开发者ID:Tebro,项目名称:xbmc-video-server,代码行数:21,代码来源:ThumbnailController.php


示例7: imageGenerator

 /**
  * Image generator.
  *
  * @param string $imageFile     Image name.
  * @param int    $maxSize       Max size.
  * @param string $newFileName   New generated file name.
  * @param int    $qualitat      Quality.
  * @param string $waterMark     Watermark.
  *
  * @return array   Image resolution.
  */
 public static function imageGenerator($imageFile, $maxSize, $newFileName, $qualitat, $waterMark = '')
 {
     if (!file_exists($imageFile)) {
         return false;
     }
     // Size setter.
     list($width, $height, $type) = getimagesize($imageFile);
     $larger = $width > $height ? $width : $height;
     $smaller = $width > $height ? $height : $width;
     if ($larger <= $maxSize) {
         $newLarger = $larger;
         $newSmaller = $smaller;
     } else {
         $multiplication = $maxSize / $larger;
         $newLarger = $maxSize;
         $newSmaller = $smaller * $multiplication;
     }
     $newWidth = $width > $height ? $newLarger : $newSmaller;
     $newHeight = $width > $height ? $newSmaller : $newLarger;
     switch ($type) {
         case 1:
             $kep = imagecreatefromgif($imageFile);
             break;
         case 2:
             $kep = imagecreatefromjpeg($imageFile);
             break;
         case 3:
             $kep = imagecreatefrompng($imageFile);
             break;
     }
     $ujkep = imagecreatetruecolor($newWidth, $newHeight);
     imagecopyresampled($ujkep, $kep, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
     imagejpeg($ujkep, $newFileName, $qualitat);
     // Contructor and set source image file
     $thumb = new Thumbnail($newFileName);
     // [OPTIONAL] set maximun memory usage, default 32 MB ('32M'). (use '16M' or '32M' for litter images)
     $thumb->memory_limit = '64M';
     // [OPTIONAL] set maximun execution time, default 30 seconds ('30'). (use '60' for big images o slow server)
     $thumb->max_execution_time = 60;
     if ($waterMark != '') {
         // [OPTIONAL] set watermark source file, only PNG format [RECOMENDED ONLY WITH GD 2]
         $thumb->img_watermark = 'static/images/watermak/' . $waterMark;
     }
     // [OPTIONAL] set watermark vertical position, TOP | CENTER | BOTTOM
     $thumb->img_watermark_Valing = 'CENTER';
     // [OPTIONAL] set watermark horizonatal position, LEFT | CENTER | RIGHT
     $thumb->img_watermark_Haling = 'CENTER';
     $thumb->process();
     $newImage = $thumb->dump();
     imagejpeg($newImage, $newFileName, $qualitat);
     return array($newWidth, $newHeight);
 }
开发者ID:carriercomm,项目名称:quantum-5,代码行数:63,代码来源:ImageHelper.php


示例8: getAvatar

 public static function getAvatar(\User $user, $res)
 {
     global $wgDefaultAvatar, $wgDefaultAvatarRes;
     $path = $wgDefaultAvatar;
     // If user exists
     if ($user && $user->getId()) {
         global $wgUploadDirectory, $wgUploadPath;
         $avatarPath = "/avatars/{$user->getId()}/{$res}.png";
         // Check if requested avatar thumbnail exists
         if (file_exists($wgUploadDirectory . $avatarPath)) {
             $path = $wgUploadPath . $avatarPath;
         } else {
             if ($res !== 'original') {
                 // Dynamically generate upon request
                 $originalAvatarPath = "/avatars/{$user->getId()}/original.png";
                 if (file_exists($wgUploadDirectory . $originalAvatarPath)) {
                     $image = Thumbnail::open($wgUploadDirectory . $originalAvatarPath);
                     $image->createThumbnail($res, $wgUploadDirectory . $avatarPath);
                     $image->cleanup();
                     $path = $wgUploadPath . $avatarPath;
                 }
             }
         }
     }
     return $path;
 }
开发者ID:zoglun,项目名称:MW-Avatar,代码行数:26,代码来源:Avatar_body.php


示例9: processUpload

 private function processUpload()
 {
     $request = $this->getRequest();
     $dataurl = $request->getVal('avatar');
     if (!$dataurl || parse_url($dataurl, PHP_URL_SCHEME) !== 'data') {
         $this->displayMessage($this->msg('avatar-notuploaded'));
         return false;
     }
     $img = Thumbnail::open($dataurl);
     global $wgMaxAvatarResolution;
     switch ($img->type) {
         case IMAGETYPE_GIF:
         case IMAGETYPE_PNG:
         case IMAGETYPE_JPEG:
             break;
         default:
             $this->displayMessage($this->msg('avatar-invalid'));
             return false;
     }
     // Must be square
     if ($img->width !== $img->height) {
         $this->displayMessage($this->msg('avatar-notsquare'));
         return false;
     }
     // Check if image is too small
     if ($img->width < 32 || $img->height < 32) {
         $this->displayMessage($this->msg('avatar-toosmall'));
         return false;
     }
     // Check if image is too big
     if ($img->width > $wgMaxAvatarResolution || $img->height > $wgMaxAvatarResolution) {
         $this->displayMessage($this->msg('avatar-toolarge'));
         return false;
     }
     $user = $this->getUser();
     Avatars::deleteAvatar($user);
     // Avatar directories
     global $wgAvatarUploadDirectory;
     $uploadDir = $wgAvatarUploadDirectory . '/' . $this->getUser()->getId() . '/';
     @mkdir($uploadDir, 0777, true);
     // We do this to convert format to png
     $img->createThumbnail($wgMaxAvatarResolution, $uploadDir . 'original.png');
     // We only create thumbnail with default resolution here. Others are generated on demand
     global $wgDefaultAvatarRes;
     $img->createThumbnail($wgDefaultAvatarRes, $uploadDir . $wgDefaultAvatarRes . '.png');
     $img->cleanup();
     $this->displayMessage($this->msg('avatar-saved'));
     global $wgAvatarLogInRC;
     $logEntry = new \ManualLogEntry('avatar', 'upload');
     $logEntry->setPerformer($this->getUser());
     $logEntry->setTarget($this->getUser()->getUserPage());
     $logId = $logEntry->insert();
     $logEntry->publish($logId, $wgAvatarLogInRC ? 'rcandudp' : 'udp');
     return true;
 }
开发者ID:nbdd0121,项目名称:MW-Avatar,代码行数:55,代码来源:SpecialUpload.php


示例10: toHtml

 public function toHtml()
 {
     $classes = "entry " . ($this->isFolder ? "folder " : "file ") . $this->type;
     $imgClass = "";
     $img = $this->type;
     $smallImg = $this->h5ai->icon($this->type);
     $bigImg = $this->h5ai->icon($this->type, true);
     $hint = "";
     if ($this->isFolder && $this->type !== "folder-parent") {
         $code = $this->h5ai->getHttpCode($this->absHref);
         $classes .= " checkedHttpCode";
         if ($code !== "h5ai") {
             if ($code === 200) {
                 $img = "folder-page";
                 $smallImg = $this->h5ai->icon("folder-page");
                 $bigImg = $this->h5ai->icon("folder-page", true);
             } else {
                 $classes .= " error";
                 $hint = "<span class='hint'> " . $code . " </span>";
             }
         }
     }
     if ($this->h5ai->showThumbs() && in_array($this->type, $this->h5ai->getThumbTypes())) {
         $imgClass = " class='thumb' ";
         $thumbnail = new Thumbnail($this->h5ai, $this->absHref, "square", 16, 16);
         $thumbnail->create();
         $smallImg = file_exists($thumbnail->getPath()) ? $thumbnail->getHref() : $thumbnail->getLiveHref();
         $thumbnail = new Thumbnail($this->h5ai, $this->absHref, "rational", 96, 46);
         $thumbnail->create();
         $bigImg = file_exists($thumbnail->getPath()) ? $thumbnail->getHref() : $thumbnail->getLiveHref();
     }
     $html = "\t<li class='" . $classes . "'>\n";
     $html .= "\t\t<a href='" . $this->absHref . "'>\n";
     $html .= "\t\t\t<span class='icon small'><img " . $imgClass . " src='" . $smallImg . "' alt='" . $img . "' /></span>\n";
     $html .= "\t\t\t<span class='icon big'><img " . $imgClass . " src='" . $bigImg . "' alt='" . $img . "' /></span>\n";
     $html .= "\t\t\t<span class='label'>" . $this->label . $hint . "</span>\n";
     $html .= "\t\t\t<span class='date' data-time='" . $this->date . "000'></span>\n";
     $html .= "\t\t\t<span class='size' data-bytes='" . $this->size . "'>" . $this->size . "</span>\n";
     $html .= "\t\t</a>\n";
     $html .= "\t</li>\n";
     return $html;
 }
开发者ID:ryochin,项目名称:h5ai,代码行数:42,代码来源:Extended.php


示例11: processImgUpload

 protected function processImgUpload()
 {
     //if no errors are found
     $thumbnail = new Thumbnail();
     if (is_uploaded_file($this->Filetemp_name)) {
         //$this->Filename = rename($this->Filename,$upload_time."_".$this->Filename);
         $tmploc = move_uploaded_file($this->Filetemp_name, $this->Temp_dir . $this->Filename);
         if ($tmploc) {
             $thumbnail->createThumbnail($this->Temp_dir . $this->Filename, $this->Thumb_dir . $this->Filename, self::MAX_THUMB_WIDTH, self::MAX_THUMB_HEIGHT);
             $thumbnail->createThumbnail($this->Temp_dir . $this->Filename, $this->Upload_dir . $this->Filename, self::MAX_IMG_WIDTH, self::MAX_IMG_HEIGHT);
             list($new_width, $new_height) = getimagesize($this->Upload_dir . $this->Filename);
             $this->Newfilename = $this->getFilename($this->Filename, ".");
             $this->File_ext = $this->get_file_extension($this->Filename);
             $this->Filesize = $this->Filesize;
             $this->Width = $new_width;
             $this->Height = $new_height;
             $this->Filetype;
         }
         $this->deleteFile($this->Temp_dir . $this->Filename);
     }
 }
开发者ID:rasarpmultimedia,项目名称:ezCMSv1.1.2,代码行数:21,代码来源:upload.class.php


示例12: createThumb

 protected static function createThumb($image, $target, $size, $quality)
 {
     $source = self::getRealFilename($image);
     //ini_set('memory_limit', '128M');
     $thumb = new Thumbnail($source);
     if ($size) {
         $size_array = explode('x', $size);
         if (is_numeric($size_array[0])) {
             $thumb->size_width($size_array[0]);
         }
         if (is_numeric($size_array[1])) {
             $thumb->size_height($size_array[1]);
         }
     }
     if (is_numeric($quality)) {
         $thumb->quality = $quality;
     }
     $thumb->process();
     if (!$thumb->save($target)) {
         throw new Image_Handler_Exception($image, $thumb->error_msg);
     }
 }
开发者ID:ctiborv,项目名称:spitzen-wein.ch,代码行数:22,代码来源:image_handler.class.php


示例13: getThumbnailUri

 /**
  * Get the thumbnail relative URI.
  *
  * @param Thumbnail $thumb
  *
  * @return mixed
  */
 private function getThumbnailUri(Thumbnail $thumb)
 {
     if ($thumb->getFileName() == null) {
         return false;
     }
     $app = $this->getContainer();
     return $app['url_generator']->generate('thumb', ['width' => $thumb->getWidth(), 'height' => $thumb->getHeight(), 'action' => $thumb->getScale(), 'file' => $thumb->getFileName()]);
 }
开发者ID:cdowdy,项目名称:boltpicture,代码行数:15,代码来源:BoltPictureExtension.php


示例14: manipulate

 /**
  * Perfoms manipulation
  *
  * @param string $from
  * @param string $to
  * @param string $options
  * @return void
  */
 public function manipulate($from, $to, $options)
 {
     if (false === class_exists('Thumbnail')) {
         throw new Yag_Manipulator_Adapter_Exception('Class Thumbnail could not be loaded');
     }
     if (!isset($options['geometry'])) {
         throw new Yag_Manipulator_Adapter_Exception('Thumbnail requires the \'geometry\' option to be set');
     }
     $matches = array();
     preg_match('/(c)?([0-9]+)x([0-9]+)/', $options['geometry'], $matches);
     $crop = empty($matches[1]) ? false : true;
     $width = $matches[2];
     $height = $matches[3];
     if (empty($matches[2])) {
         throw new Yag_Manipulator_Adapter_Exception('Invalid geometry pattern \'' . $options['geometry'] . '\'');
     }
     if (empty($matches[3])) {
         throw new Yag_Manipulator_Adapter_Exception('Invalid geometry pattern \'' . $options['geometry'] . '\'');
     }
     $thumbnail = new Thumbnail($from);
     // TODO: Fix error handling around this...
     $quality = 80;
     if (false == $crop) {
         $thumbnail->resize($width, $height);
         $quality = 100;
     } else {
         if ($width == $height) {
             // Well works for now... the crop for ImageTransform is a bit better
             // but who cares?
             $thumbnail->cropFromCenter($width);
         } else {
             $thumbnail->crop(0, 0, $width, $height);
         }
     }
     $thumbnail->save($to, $quality);
 }
开发者ID:johannilsson,项目名称:yag,代码行数:44,代码来源:Thumbnail.php


示例15: createThumbs

 protected function createThumbs($file, $targets)
 {
     global $eshop_picture_config;
     $dir_photo = KIWI_DIR_PRODUCTS;
     foreach ($targets as $target) {
         if (!array_key_exists($target, $eshop_picture_config)) {
             throw new Exception('Für das Vorschaubild Ziel unbekannt');
         }
         if (is_array($eshop_picture_config[$target])) {
             $t = new Thumbnail("{$dir_photo}photo/{$file}");
             $t->size($eshop_picture_config[$target][0], $eshop_picture_config[$target][1]);
             $t->quality = 80;
             $t->output_format = 'JPG';
             $this->log("Erstellen einer Miniaturansicht zu das Bild {$file} in das Verzeichnis {$target}");
             $t->process();
             if (!$this->_simulation) {
                 $status = $t->save("{$dir_photo}{$target}/{$file}");
                 if (!$status) {
                     throw new Exception('Fehler beim Speichern einer Miniaturansicht des Bildes');
                 }
             }
         }
     }
 }
开发者ID:ctiborv,项目名称:spitzen-wein.ch,代码行数:24,代码来源:kiwi_picture_importer.class.php


示例16: getThumbnail

 public function getThumbnail($path)
 {
     $this->ensureAccess($path);
     $image = new Thumbnail($path);
     $this->setImageHeaders($path, $image->getType());
     $image->downscale();
     $image->render();
 }
开发者ID:kyhfan,项目名称:babience_awards,代码行数:8,代码来源:ImageBrowser.php


示例17: testExistingFileHasContent

 function testExistingFileHasContent()
 {
     $thumbnail = new Thumbnail(array('id' => 'example/Untitled-17.jpg'));
     $raw_data = $thumbnail->getData();
     $this->assertTrue(strlen($raw_data) > 0);
 }
开发者ID:johnulist,项目名称:Markab,代码行数:6,代码来源:thumbnail.test.php


示例18: parseTargeImage_old

 function parseTargeImage_old($picPath)
 {
     $getrxpath = dirname(__FILE__) . '/../..';
     $ret_graph_small_picture_path = '/data/attachment/forum/mobcentSmallPreview/';
     $ret_graph_big_picture_path = '/data/attachment/forum/mobcentBigPreview/';
     $ret_graph_xgsize_picture_path = '/data/attachment/forum/xgsize/';
     $origan_path = $getrxpath . "/../../data/attachment/forum/" . $picPath['attachment'];
     $origan = explode('/', $picPath['attachment']);
     $origan_path_date = $getrxpath . "/../../data/attachment/forum/" . date('Ym/d', $picPath['dateline']) . '/' . $origan[count($origan) - 1];
     $path = pathinfo($picPath['attachment']);
     $fileName = $path['filename'] . '.' . $path['extension'];
     $Url = explode('/', $this->getRootFolder(SELF_FOLDER));
     unset($Url[count($Url) - 1]);
     $Url = implode('/', $Url);
     $ret_suffix_xgsize = $ret_graph_xgsize_picture_path . $picPath['attachment'];
     $ret_suffix = $ret_graph_small_picture_path . $picPath['attachment'];
     $ret_path_attachmentImg = $getrxpath . '/..' . $ret_suffix;
     $ret_path_small = $getrxpath . '/..' . $ret_graph_small_picture_path . $path['dirname'] . '/';
     $ret_path_big = $getrxpath . '/..' . $ret_graph_big_picture_path . $path['dirname'] . '/';
     $size = 160;
     $sizeBig = 480;
     if (file_exists($origan_path)) {
         if (file_exists($ret_path_attachmentImg)) {
             $pic_path = '/mobcent' . $ret_suffix_xgsize;
         } else {
             $pic = new Thumbnail($origan_path);
             if ($pic->zoomcutPic($origan_path, $ret_path_small, $fileName, $size) && $pic->zoomcutPic($origan_path, $ret_path_big, $fileName, $sizeBig)) {
                 $pic_path = '/mobcent' . $ret_graph_xgsize_picture_path . $path['dirname'] . '/' . $path['filename'] . '.' . $path['extension'];
             }
         }
     } else {
         if (file_exists($origan_path_date)) {
             $path = pathinfo(date('Ym/d', $picPath['dateline']) . '/' . $origan[count($origan) - 1]);
             $fileName = $path['filename'] . '.' . $path['extension'];
             $Url = explode('/', $this->getRootFolder(SELF_FOLDER));
             unset($Url[count($Url) - 1]);
             $Url = implode('/', $Url);
             $ret_suffix_xgsize = $ret_graph_xgsize_picture_path . '/' . date('Ym/d', $picPath['dateline']) . '/' . $origan[count($origan) - 1];
             $ret_suffix = $ret_graph_small_picture_path . '/' . date('Ym/d', $picPath['dateline']) . '/' . $origan[count($origan) - 1];
             $ret_path_attachmentImg = $this->getPath() . '/..' . $ret_suffix;
             $ret_path_small = $this->getPath() . '/..' . $ret_graph_small_picture_path . $path['dirname'] . '/';
             $ret_path_big = $this->getPath() . '/..' . $ret_graph_big_picture_path . $path['dirname'] . '/';
             $size = 160;
             if (file_exists($ret_path_attachmentImg)) {
                 $pic_path = '/mobcent' . $ret_suffix_xgsize;
             } else {
                 $pic = new Thumbnail($origan_path_date);
                 if ($pic->zoomcutPic($origan_path_date, $ret_path_small, $fileName, $size) && $pic->zoomcutPic($origan_path_date, $ret_path_big, $fileName, $sizeBig)) {
                     $pic_path = '/mobcent' . $ret_graph_xgsize_picture_path . $path['dirname'] . '/' . $path['filename'] . '.' . $path['extension'];
                 }
             }
         }
     }
     return $pic_path;
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:55,代码来源:topic.php


示例19: error_reporting

<?php

//error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
error_reporting(0);
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/*
CARE2X Integrated Information System  for Hospitals and Health Care Organizations and Services
Copyright (C) 2002,2003,2004,2005  Elpidio Latorilla & Intellin.org	

GNU GPL. For details read file "copy_notice.txt".
*/
if (!extension_loaded('gd')) {
    dl('php_gd.dll');
}
require $root_path . 'classes/thumbnail/thumbnail.class.php';
$myThumb = new Thumbnail();
// Start using a class
$myThumb->setMaxSize($mx, $my);
// Specify maximum size (width, height)
$myThumb->setImgSource($root_path . $imgfile);
// Specify original image filename
$myThumb->Create('');
// Specify destination image filename or leave empty to output directly
开发者ID:patmark,项目名称:care2x-tz,代码行数:24,代码来源:thumbnail.php


示例20: js_fail

if (!is_file($fullpath)) {
    js_fail("File {$fullpath} does not exist.");
}
$imgInfo = @getImageSize($fullpath);
//Not an image, bail out.
if (!is_array($imgInfo)) {
    js_fail("File {$fullpath} is not an image.");
}
if (!isset($_GET['to'])) {
    $resized = $manager->getResizedName($fullpath, $_GET['width'], $_GET['height']);
    $_GET['to'] = $manager->getResizedName($image, $_GET['width'], $_GET['height'], FALSE);
} else {
    $resized = Files::makeFile($manager->getImagesDir(), $_GET['to']);
}
// Check to see if it already exists
if (is_file($resized)) {
    // And is newer
    if (filemtime($resized) >= filemtime($fullpath)) {
        js_success($_GET['to']);
    }
}
// resize (thumbnailer will do this for us just fine)
$thumbnailer = new Thumbnail($_GET['width'], $_GET['height']);
$thumbnailer->proportional = FALSE;
$thumbnailer->createThumbnail($fullpath, $resized);
// did it work?
if (is_file($resized)) {
    js_success($_GET['to']);
} else {
    js_fail("Resize Failed.");
}
开发者ID:jwlynch,项目名称:openacs.core,代码行数:31,代码来源:resizer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Ticket类代码示例发布时间:2022-05-23
下一篇:
PHP Throwable类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap