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


PHP ImageHelper::isImage方法代码示例

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


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

示例1: _processMedia

 /**
  * Process media files
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see
  * @access 		private
  * @param
  * @return
  * @since 		4.0
  */
 private function _processMedia()
 {
     $jinput = JFactory::getApplication()->input;
     $template = $jinput->get('template', null, null);
     $csvilog = $jinput->get('csvilog', null, null);
     $generate_image = $template->get('auto_generate_image_name', 'image', false);
     // Check if any image handling needs to be done
     if (!is_null($this->file_url) || $generate_image) {
         // Check if we have any images
         if (is_null($this->file_url) && $generate_image) {
             $this->_createImageName();
         }
         // Create an array of images to process
         $images = explode('|', $this->file_url);
         $thumbs = explode('|', $this->file_url_thumb);
         $titles = explode('|', $this->file_title);
         $descriptions = explode('|', $this->file_description);
         $metas = explode('|', $this->file_meta);
         $order = explode('|', $this->file_ordering);
         $ordering = 1;
         $max_width = $template->get('resize_max_width', 'image', 1024);
         $max_height = $template->get('resize_max_height', 'image', 768);
         // Image handling
         $imagehelper = new ImageHelper();
         // Delete existing image links
         if ($template->get('delete_product_images', 'image', false)) {
             $db = JFactory::getDbo();
             $query = $db->getQuery(true)->delete($db->qn('#__virtuemart_product_medias'))->where($db->qn('virtuemart_product_id') . '=' . $this->virtuemart_product_id);
             $db->setQuery($query);
             $db->query();
             $csvilog->addDebug('Delete images', true);
         }
         foreach ($images as $key => $image) {
             $image = trim($image);
             // Create image name if needed
             if (count($images) == 1) {
                 $img_counter = 0;
             } else {
                 $img_counter = $key + 1;
             }
             if ($generate_image) {
                 $name = null;
                 $name = $this->_createImageName($img_counter);
                 if (!empty($name)) {
                     $image = $name;
                 }
             }
             if (!empty($image)) {
                 // Get the image path
                 $imgpath = $template->get('file_location_product_files', 'path');
                 // Verify the original image
                 if ($imagehelper->isRemote($image)) {
                     $original = $image;
                     $remote = true;
                     $full_path = $imgpath;
                 } else {
                     // Check if the image contains the image path
                     $dirname = dirname($image);
                     if (strpos($imgpath, $dirname) !== false) {
                         $image = basename($image);
                     }
                     $original = $imgpath . $image;
                     $remote = false;
                     // Get subfolders
                     $path_parts = pathinfo($original);
                     $full_path = $path_parts['dirname'] . '/';
                 }
                 // Generate image names
                 if ($template->get('process_image', 'image', false)) {
                     if ($generate_image) {
                         $file_details = $imagehelper->ProcessImage($original, $full_path, $this->product_full_image_output);
                     } else {
                         $file_details = $imagehelper->ProcessImage($original, $full_path);
                     }
                 } else {
                     $file_details['exists'] = true;
                     $file_details['isimage'] = $imagehelper->isImage(JPATH_SITE . '/' . $image);
                     $file_details['name'] = $image;
                     $file_details['output_name'] = basename($image);
                     if (file_exists(JPATH_SITE . '/' . $image)) {
                         $file_details['mime_type'] = $imagehelper->findMimeType($image);
                     } else {
                         $file_details['mime_type'] = '';
                     }
                     $file_details['output_path'] = $full_path;
                 }
                 // Process the file details
                 if ($file_details['exists']) {
//.........这里部分代码省略.........
开发者ID:alesconti,项目名称:FF_2015,代码行数:101,代码来源:productimport.php


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