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


PHP JImage::getPath方法代码示例

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


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

示例1: save


//.........这里部分代码省略.........
         }
     }
     $path = '';
     $path_hover = '';
     jimport('joomla.filesystem.file');
     $imageType = null;
     $imageMimeType = null;
     $imageSize = null;
     $image_hoverType = null;
     $image_hoverMimeType = null;
     $image_hoverSize = null;
     // Create original image with new name (upload from client)
     if (count($images) && !empty($images['tmp_name'])) {
         // Get image file type
         $imageType = JFile::getExt($images['name']);
         $imageType = strtolower($imageType);
         // Get image's mime type
         $imageMimeType = $images['type'];
         // Get image's size
         $imageSize = $images['size'];
         $path = COM_TZ_PORTFOLIO_PLUS_MEDIA_ARTICLE_ROOT . DIRECTORY_SEPARATOR;
         $path .= $data->alias . '-' . $data->id . '_o';
         $path .= '.' . JFile::getExt($images['name']);
         if ($input->getCmd('task') == 'save2copy' && $input->getInt('id')) {
             $image_data['url_server'] = null;
         }
     } elseif (isset($image_data['url_server']) && !empty($image_data['url_server'])) {
         // Create original image with new name (upload from server)
         // Get image file type
         $imageType = JFile::getExt($image_data['url_server']);
         $imageType = strtolower($imageType);
         // Get image's mime type
         $imageObj->loadFile(JPATH_ROOT . DIRECTORY_SEPARATOR . $image_data['url_server']);
         $imageMimeType = $imageObj->getImageFileProperties($imageObj->getPath());
         $imageMimeType = $imageMimeType->mime;
         // Get image's size
         $imageSize = $imageMimeType->filesize;
         $path = COM_TZ_PORTFOLIO_PLUS_MEDIA_ARTICLE_ROOT . DIRECTORY_SEPARATOR;
         $path .= $data->alias . '-' . $data->id . '_o';
         $path .= '.' . JFile::getExt($image_data['url_server']);
     }
     // Create original image hover with new name (upload from client)
     if (count($images_hover) && !empty($images_hover['tmp_name'])) {
         // Get image hover file type
         $image_hoverType = JFile::getExt($images_hover['name']);
         $image_hoverType = strtolower($image_hoverType);
         // Get image hover's mime type
         $image_hoverMimeType = $images_hover['type'];
         // Get image's size
         $image_hoverSize = $images_hover['size'];
         $path_hover = COM_TZ_PORTFOLIO_PLUS_MEDIA_ARTICLE_ROOT . DIRECTORY_SEPARATOR;
         $path_hover .= $data->alias . '-' . $data->id . '-h_o';
         $path_hover .= '.' . JFile::getExt($images_hover['name']);
         if ($input->getCmd('task') == 'save2copy' && $input->getInt('id')) {
             $image_data['url_hover_server'] = null;
         }
     } elseif (isset($image_data['url_hover_server']) && !empty($image_data['url_hover_server'])) {
         // Create original image with new name (upload from server)
         // Get image hover file type
         $image_hoverType = JFile::getExt($image_data['url_hover_server']);
         $image_hoverType = strtolower($image_hoverType);
         // Get image hover's mime type
         $imageObj->loadFile(JPATH_ROOT . DIRECTORY_SEPARATOR . $image_data['url_hover_server']);
         $image_hoverMimeType = $imageObj->getImageFileProperties($imageObj->getPath());
         $image_hoverMimeType = $image_hoverMimeType->mime;
         // Get image hover's size
开发者ID:templaza,项目名称:tz_portfolio_plus,代码行数:67,代码来源:image.php

示例2: getThumbnail

 public static function getThumbnail($image)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $params = JComponentHelper::getComponent('com_digicom')->params;
     if (empty($image)) {
         return '';
     }
     if (!JFile::exists($image)) {
         return $image;
     }
     if ($params->get('image_thumb_enable')) {
         $image_thumb_width = $params->get('image_thumb_width');
         $image_thumb_height = $params->get('image_thumb_height');
         $image_thumb_method = $params->get('image_thumb_method', 6);
         $imageunique = md5($image . $image_thumb_width . $image_thumb_height);
         $path = JPATH_ROOT . '/images/digicom/products';
         JFolder::create($path);
         // Generate thumb name
         $jimage = new JImage($image);
         $filename = pathinfo($jimage->getPath(), PATHINFO_FILENAME);
         $fileExtension = pathinfo($jimage->getPath(), PATHINFO_EXTENSION);
         $thumbFileName = $filename . '_' . $image_thumb_width . 'x' . $image_thumb_height . '.' . $fileExtension;
         $thumbpath = JPATH_ROOT . '/images/digicom/products/' . $thumbFileName;
         $thumburl = JURI::root() . 'images/digicom/products/' . $thumbFileName;
         if (JFile::exists($thumbpath)) {
             return $thumburl;
         }
         $image = $jimage->createThumbs(array($image_thumb_width . 'x' . $image_thumb_height), $image_thumb_method, $path);
         $thumburl = str_replace(JPATH_SITE . '/', '', $image[0]->getPath());
         return $thumburl;
     } else {
         return $image;
     }
 }
开发者ID:Shtier,项目名称:digicom,代码行数:35,代码来源:digicom.php

示例3: createImage

 /**
  * Create a cropped and resized image from the uploaded original
  *
  * @return bool
  *
  * @since   1.0.0.3
  */
 protected function createImage($src, $dest, $width, $height)
 {
     $original = new JImage($src);
     $org_width = $original->getWidth();
     $org_height = $original->getHeight();
     if ($org_width / $width < $org_height / $height) {
         $original->resize($width, 0, false);
     } else {
         $original->resize(0, $height, false);
     }
     $thumb = $original->crop($width, $height, null, null, true);
     $filename = pathinfo($original->getPath(), PATHINFO_FILENAME);
     $extension = pathinfo($original->getPath(), PATHINFO_EXTENSION);
     if (!$thumb->toFile(JPATH_ROOT . $dest . $filename . "." . $extension)) {
         return false;
     }
     $original->destroy();
     $thumb->destroy();
     return true;
 }
开发者ID:SchoolDangersOrg,项目名称:com_mapbox,代码行数:27,代码来源:images.php


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