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


PHP ImageHelper::addWatermark方法代码示例

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


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

示例1: getProcessRecord

 /**
  * Process each record and store it in the database
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see
  * @access 		public
  * @param
  * @return
  * @since 		3.0
  */
 public function getProcessRecord()
 {
     $db = JFactory::getDbo();
     $jinput = JFactory::getApplication()->input;
     $csvilog = $jinput->get('csvilog', null, null);
     $template = $jinput->get('template', null, null);
     // Process the image
     $this->_processMedia();
     // Set some basic values
     if (!isset($this->modified_on)) {
         $this->_medias->modified_on = $this->date->toSql();
         $this->_medias->modified_by = $this->user->id;
     }
     // Find the media ID
     $this->_medias->file_url = $this->file_url;
     $this->_medias->check();
     $this->virtuemart_media_id = $this->_medias->virtuemart_media_id;
     // Do we need to delete a media file?
     if ($this->media_delete == 'Y') {
         $this->_deleteMedia();
     } else {
         // Check if the media exists
         if (empty($this->virtuemart_media_id)) {
             $this->_medias->created_on = $this->date->toMySQL();
             $this->_medias->created_by = $this->user->id;
         }
         // Bind all the data
         $this->_medias->bind($this);
         // Store the data
         if ($this->_medias->store()) {
             if ($this->queryResult() == 'UPDATE') {
                 $csvilog->AddStats('updated', JText::_('COM_CSVI_UPDATE_MEDIAFILE'));
             } else {
                 $csvilog->AddStats('added', JText::_('COM_CSVI_ADD_MEDIAFILE'));
             }
             // Watermark image if needed
             $imagehelper = new ImageHelper();
             if ($template->get('full_watermark', 'image')) {
                 $imagehelper->addWatermark(JPATH_SITE . '/' . $this->_medias->file_url);
             }
             // Add a link to the product if the SKU is specified
             if (isset($this->product_sku)) {
                 $this->_product_medias->virtuemart_media_id = $this->_medias->virtuemart_media_id;
                 $this->_product_medias->virtuemart_product_id = $this->helper->getProductId();
                 if (!$this->_product_medias->check()) {
                     if ($this->_product_medias->store()) {
                         if ($this->queryResult() == 'UPDATE') {
                             $csvilog->AddStats('updated', JText::_('COM_CSVI_UPDATE_MEDIAXREF'));
                         } else {
                             $csvilog->AddStats('added', JText::_('COM_CSVI_ADD_MEDIAXREF'));
                         }
                     }
                 }
             }
         } else {
             $csvilog->AddStats('incorrect', JText::sprintf('COM_CSVI_MEDIAFILE_NOT_ADDED', $this->_medias->getError()));
         }
         // Store the debug message
         $csvilog->addDebug(JText::_('COM_CSVI_MEDIAFILE_QUERY'), true);
     }
     // Clean the tables
     $this->cleanTables();
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:75,代码来源:mediaimport.php

示例2: _processMedia


//.........这里部分代码省略.........
                     if ($file_details['exists']) {
                         // Check if the image is an external image
                         if (substr($file_details['name'], 0, 4) == 'http') {
                             $csvilog->AddStats('incorrect', 'COM_CSVI_VM_NOSUPPORT_URL');
                         } else {
                             $title = isset($titles[$key]) ? $titles[$key] : $file_details['output_name'];
                             $description = isset($descriptions[$key]) ? $descriptions[$key] : '';
                             $meta = isset($metas[$key]) ? $metas[$key] : '';
                             $media = array();
                             $media['virtuemart_vendor_id'] = $this->virtuemart_vendor_id;
                             if ($template->get('autofill', 'image')) {
                                 $media['file_title'] = $file_details['output_name'];
                                 $media['file_description'] = $file_details['output_name'];
                                 $media['file_meta'] = $file_details['output_name'];
                             } else {
                                 $media['file_title'] = $title;
                                 $media['file_description'] = $description;
                                 $media['file_meta'] = $meta;
                             }
                             $media['file_mimetype'] = $file_details['mime_type'];
                             $media['file_type'] = 'product';
                             $media['file_is_product_image'] = 1;
                             $media['file_is_downloadable'] = 0;
                             $media['file_is_forSale'] = 0;
                             $media['file_url'] = empty($file_details['output_path']) ? $file_details['output_name'] : $file_details['output_path'] . $file_details['output_name'];
                             $media['published'] = $this->published;
                             // Create the thumbnail
                             if ($file_details['isimage']) {
                                 $thumb = isset($thumbs[$key]) ? $thumbs[$key] : null;
                                 if ($template->get('thumb_create', 'image')) {
                                     $thumb_sizes = getimagesize(JPATH_SITE . '/' . $media['file_url']);
                                     if (empty($thumb)) {
                                         $thumb = 'resized/' . basename($media['file_url']);
                                     }
                                     if ($thumb_sizes[0] < 1024 || $thumb_sizes[1] < 768) {
                                         $media['file_url_thumb'] = $imagehelper->createThumbnail($media['file_url'], $template->get('file_location_product_images', 'path'), $thumb);
                                     } else {
                                         $media['file_url_thumb'] = '';
                                     }
                                 } else {
                                     $media['file_url_thumb'] = empty($thumb) ? $media['file_url'] : $file_details['output_path'] . $thumb;
                                     if (substr($media['file_url_thumb'], 0, 4) == 'http') {
                                         $csvilog->addDebug(JText::sprintf('COM_CSVI_RESET_THUMB_NOHTTP', $media['file_url_thumb']));
                                         $media['file_url_thumb'] = '';
                                     }
                                 }
                             } else {
                                 $media['file_is_product_image'] = 0;
                                 $media['file_url_thumb'] = '';
                             }
                             // Bind the media data
                             $this->_medias->bind($media);
                             // Check if the media image already exists
                             $this->_medias->check();
                             // Store the media data
                             if ($this->_medias->store()) {
                                 if ($this->queryResult() == 'UPDATE') {
                                     $csvilog->AddStats('updated', JText::_('COM_CSVI_UPDATE_MEDIA'));
                                 } else {
                                     $csvilog->AddStats('added', JText::_('COM_CSVI_ADD_MEDIA'));
                                 }
                                 // Store the debug message
                                 $csvilog->addDebug('COM_CSVI_MEDIA_QUERY', true);
                                 // Watermark the image
                                 if ($template->get('full_watermark', 'image') && $file_details['isimage']) {
                                     $imagehelper->addWatermark(JPATH_SITE . '/' . $media['file_url']);
                                 }
                                 // Store the product image relation
                                 $data = array();
                                 $data['virtuemart_product_id'] = $this->virtuemart_product_id;
                                 $data['virtuemart_media_id'] = $this->_medias->virtuemart_media_id;
                                 $data['ordering'] = $ordering;
                                 $this->_product_medias->bind($data);
                                 if (!$this->_product_medias->check()) {
                                     if ($this->_product_medias->store()) {
                                         $csvilog->addDebug('COM_CSVI_STORE_PRODUCT_IMAGE_RELATION', true);
                                         $ordering++;
                                     }
                                 } else {
                                     $csvilog->addDebug('Product image relation already exists');
                                 }
                             } else {
                                 $csvilog->AddStats('incorrect', JText::sprintf('COM_CSVI_MEDIA_NOT_ADDED', $this->_medias->getError()));
                                 return false;
                             }
                             // Reset the product media table
                             $this->_medias->reset();
                             $this->_product_medias->reset();
                         }
                         // else
                     }
                     // if
                 }
                 // if
             }
             // foreach
         }
         // if
     }
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:101,代码来源:productimport.php

示例3: getProcessRecord

 /**
  * Process each record and store it in the database
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see
  * @access 		public
  * @param
  * @return
  * @since 		5.8
  */
 public function getProcessRecord()
 {
     $db = JFactory::getDbo();
     $jinput = JFactory::getApplication()->input;
     $csvilog = $jinput->get('csvilog', null, null);
     $template = $jinput->get('template', null, null);
     // Find the media ID, we only use the image name
     $this->_images->fname = basename($this->fname);
     $this->_images->check();
     $this->id = $this->_images->id;
     // Do we need to delete a media file?
     if ($this->image_delete == 'Y') {
         if ($this->id) {
             $this->_deleteImage();
         } else {
             $csvilog->AddStats('information', JText::_('COM_CSVI_NO_IMAGE_ID'));
         }
     } else {
         // Find the property ID
         $based_on = $template->get('update_based_on', 'property', 'id');
         if ($based_on != 'id') {
             // Find the property ID
             $db = JFactory::getDbo();
             $propid = $this->propid;
             $query = $db->getQuery(true)->select($db->qn('id'))->from($db->qn('#__ezrealty'))->where($db->qn($based_on) . ' = ' . $db->q($propid));
             $db->setQuery($query);
             $this->propid = $db->loadResult();
             if (!$this->propid) {
                 $csvilog->AddStats('error', JText::sprintf('COM_CSVI_CANNOT_FIND_PROPERTY', $propid));
                 return false;
             }
         }
         // Process the image
         $this->_processMedia();
         // Bind all the data
         $this->_images->bind($this);
         // Store the data
         if ($this->_images->store()) {
             if ($this->queryResult() == 'UPDATE') {
                 $csvilog->AddStats('updated', JText::_('COM_CSVI_UPDATE_IMAGEFILE'));
             } else {
                 $csvilog->AddStats('added', JText::_('COM_CSVI_ADD_IMAGEFILE'));
             }
             // Watermark image if needed
             $imagehelper = new ImageHelper();
             if ($template->get('full_watermark', 'image')) {
                 $imagehelper->addWatermark(JPATH_SITE . '/' . $this->_images->fname);
             }
         } else {
             $csvilog->AddStats('incorrect', JText::sprintf('COM_CSVI_MEDIAFILE_NOT_ADDED', $this->_images->getError()));
         }
         // Store the debug message
         $csvilog->addDebug(JText::_('COM_CSVI_IMAGEFILE_QUERY'), true);
     }
     // Clean the tables
     $this->cleanTables();
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:69,代码来源:imageimport.php


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