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


PHP JUDirectoryHelper::generateImageNameByListing方法代码示例

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


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

示例1: onSaveListing

 public function onSaveListing($value = '')
 {
     $gallery = $value;
     $date = JFactory::getDate();
     $image_ordering = 0;
     $configListingOriginalImageDirectory = JUDirectoryFrontHelper::getDirectory("listing_original_image_directory", "media/com_judirectory/images/gallery/original/");
     $configListingSmallImageDirectory = JUDirectoryFrontHelper::getDirectory("listing_small_image_directory", "media/com_judirectory/images/gallery/small/");
     $configListingBigImageDirectory = JUDirectoryFrontHelper::getDirectory("listing_big_image_directory", "media/com_judirectory/images/gallery/big/");
     $listing_original_image_directory = JPATH_ROOT . "/" . $configListingOriginalImageDirectory . $this->listing_id . "/";
     $listing_small_image_directory = JPATH_ROOT . "/" . $configListingSmallImageDirectory . $this->listing_id . "/";
     $listing_big_image_directory = JPATH_ROOT . "/" . $configListingBigImageDirectory . $this->listing_id . "/";
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judirectory/tables', 'JUDirectoryTable');
     $imageTable = JTable::getInstance('Image', 'JUDirectoryTable');
     if (!$this->is_new) {
         if (!empty($gallery['old'])) {
             foreach ($gallery['old'] as $image) {
                 if ($imageTable->load($image['id'])) {
                     if ($image['remove'] == 1) {
                         if ($imageTable->delete()) {
                             JFile::delete($listing_original_image_directory . $image['file_name']);
                             JFile::delete($listing_small_image_directory . $image['file_name']);
                             JFile::delete($listing_big_image_directory . $image['file_name']);
                         }
                     } else {
                         $image_ordering++;
                         $_image = array();
                         $_image['title'] = $image['title'];
                         $_image['description'] = $image['description'];
                         $_image['published'] = $image['published'];
                         $_image['ordering'] = $image_ordering;
                         $imageTable->bind($_image);
                         $imageTable->check();
                         $imageTable->store();
                     }
                 }
             }
         }
     }
     if (!empty($gallery['new'])) {
         if (!JFolder::exists($listing_original_image_directory)) {
             $file_index = $listing_original_image_directory . 'index.html';
             $buffer = "<!DOCTYPE html><title></title>";
             JFile::write($file_index, $buffer);
         }
         if (!JFolder::exists($listing_small_image_directory)) {
             $file_index = $listing_small_image_directory . 'index.html';
             $buffer = "<!DOCTYPE html><title></title>";
             JFile::write($file_index, $buffer);
         }
         if (!JFolder::exists($listing_big_image_directory)) {
             $file_index = $listing_big_image_directory . 'index.html';
             $buffer = "<!DOCTYPE html><title></title>";
             JFile::write($file_index, $buffer);
         }
         $countNewImage = 0;
         foreach ($gallery['new'] as $image) {
             $img_file_name = JUDirectoryHelper::generateImageNameByListing($this->listing_id, $image['name']);
             if (!JFile::move($image['tmp_name'], $listing_original_image_directory . $img_file_name) || !JUDirectoryHelper::renderImages($listing_original_image_directory . $img_file_name, $listing_small_image_directory . $img_file_name, 'listing_small', true, null, $this->listing_id) || !JUDirectoryHelper::renderImages($listing_original_image_directory . $img_file_name, $listing_big_image_directory . $img_file_name, 'listing_big', true, null, $this->listing_id)) {
                 continue;
             }
             $imageTable->reset();
             $dataImage = array('id' => 0, 'file_name' => $img_file_name, 'listing_id' => $this->listing_id, 'published' => 1, 'ordering' => ++$image_ordering, 'created' => $date->toSql());
             $imageTable->bind($dataImage);
             $imageTable->check();
             $imageTable->store();
             $countNewImage++;
         }
     }
     return null;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:70,代码来源:core_gallery.php


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