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


PHP JUDownloadHelper::renderImages方法代码示例

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


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

示例1: insertUpdateDocument


//.........这里部分代码省略.........
     $query->where("d.id = {$docId}");
     $query->where("field.field_name != 'id'");
     $query->where("field.field_name != 'cat_id'");
     $query->group('field.id');
     $query->order('ordering ASC');
     $db->setQuery($query);
     $fields = $db->loadObjectList();
     $docObj = JUDownloadHelper::getDocumentById($docId);
     foreach ($fields as $field) {
         if (isset($fieldsData[$field->id])) {
             $fieldObj = JUDownloadFrontHelperField::getField($field, $docObj);
             $fieldObj->fields_data = $fieldsData;
             $fieldValue = $fieldsData[$field->id];
             $fieldObj->is_new_doc = $isInsert;
             $fieldValue = $fieldObj->onImportDocument($fieldValue);
             $fieldObj->storeValue($fieldValue);
         }
     }
     if ($iconPath) {
         $iconPath = JUDownloadHelper::getPhysicalPath($iconPath);
         if (!$iconPath) {
             $messages[] = JText::sprintf('COM_JUDOWNLOAD_CSV_PROCESS_FILE_S_NOT_FOUND', $iconPath);
         } else {
             if ($data['id'] > 0) {
                 if ($table->icon) {
                     if (JFile::exists($iconDir . $table->icon)) {
                         JFile::delete($iconDir . $table->icon);
                         JFile::delete($originalDir . $table->icon);
                     }
                 }
             }
             $iconName = basename($iconPath);
             $iconName = $docId . "_" . JUDownloadHelper::fileNameFilter($iconName);
             if (JFile::copy($iconPath, $originalDir . $iconName) && JUDownloadHelper::renderImages($originalDir . $iconName, $iconDir . $iconName, 'document_icon', true, null, $data['id'])) {
                 $table->icon = $iconName;
                 $table->store();
             }
         }
     }
     $imageTable = JTable::getInstance("Image", "JUDownloadTable");
     if (!empty($gallery)) {
         $dir_document_ori = JPATH_SITE . "/" . JUDownloadFrontHelper::getDirectory("document_original_image_directory", "media/com_judownload/images/gallery/original/") . $docId . "/";
         $dir_document_small = JPATH_SITE . "/" . JUDownloadFrontHelper::getDirectory("document_small_image_directory", "media/com_judownload/images/gallery/small/") . $docId . "/";
         $dir_document_big = JPATH_SITE . "/" . JUDownloadFrontHelper::getDirectory("document_big_image_directory", "media/com_judownload/images/gallery/big/") . $docId . "/";
         if (!JFolder::exists($dir_document_ori)) {
             $file_index = $dir_document_ori . 'index.html';
             $buffer = "<!DOCTYPE html><title></title>";
             JFile::write($file_index, $buffer);
         }
         if (!JFolder::exists($dir_document_small)) {
             $file_index = $dir_document_small . 'index.html';
             $buffer = "<!DOCTYPE html><title></title>";
             JFile::write($file_index, $buffer);
         }
         if (!JFolder::exists($dir_document_big)) {
             $file_index = $dir_document_big . 'index.html';
             $buffer = "<!DOCTYPE html><title></title>";
             JFile::write($file_index, $buffer);
         }
         $image_ordering = 1;
         $date = JFactory::getDate();
         foreach ($gallery as $imagePath) {
             $imagePath = JUDownloadHelper::getPhysicalPath($imagePath);
             if (!$imagePath) {
                 $messages[] = JText::sprintf('COM_JUDOWNLOAD_CSV_PROCESS_FILE_S_NOT_FOUND', $imagePath);
                 continue;
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:67,代码来源:csvprocess.php

示例2: saveCategoryImage

 public function saveCategoryImage($pk, $table, &$data)
 {
     $app = JFactory::getApplication();
     $jInput = $app->input;
     if ($pk > 0) {
         if ($jInput->post->getInt('remove_jform_images_intro_image', 0) == 1 || $jInput->post->getInt('remove_jform_images_detail_image', 0) == 1 && $jInput->post->getInt('use_detail_image', 0) == 1) {
             $intro_image_dir = JPATH_ROOT . "/" . JUDownloadFrontHelper::getDirectory("category_intro_image_directory", "media/com_judownload/images/category/intro/") . $data['images']['intro_image'];
             $ori_intro_image_dir = JPATH_ROOT . "/" . JUDownloadFrontHelper::getDirectory("category_intro_image_directory", "media/com_judownload/images/category/intro/") . 'original/' . $data['images']['intro_image'];
             $data['images']['intro_image'] = '';
             $data['images']['intro_image_alt'] = '';
             $data['images']['intro_image_caption'] = '';
             JFile::delete($ori_intro_image_dir);
             JFile::delete($intro_image_dir);
         }
         if ($jInput->post->getInt('remove_jform_images_detail_image', 0) == 1) {
             $full_image_dir = JPATH_ROOT . "/" . JUDownloadFrontHelper::getDirectory("category_detail_image_directory", "media/com_judownload/images/category/detail/") . $data['images']['detail_image'];
             $ori_full_image_dir = JPATH_ROOT . "/" . JUDownloadFrontHelper::getDirectory("category_detail_image_directory", "media/com_judownload/images/category/detail/") . "original/" . $data['images']['detail_image'];
             $data['images']['detail_image'] = '';
             $data['images']['detail_image_alt'] = '';
             $data['images']['detail_image_caption'] = '';
             JFile::delete($full_image_dir);
             JFile::delete($ori_full_image_dir);
         }
     }
     $mime_types = array("image/jpeg", "image/pjpeg", "image/png", "image/gif", "image/bmp", "image/x-windows-bmp");
     $num_files_failed_mime_type = 0;
     $images = $app->input->files->get('images', array());
     $old_ori_intro_image_path = isset($data['images']['intro_image']) && $data['images']['intro_image'] ? JUDownloadFrontHelper::getDirectory("category_intro_image_directory", "media/com_judownload/images/category/intro/") . 'original/' . $data['images']['intro_image'] : '';
     $old_intro_image_path = $old_ori_intro_image_path ? JUDownloadFrontHelper::getDirectory("category_intro_image_directory", "media/com_judownload/images/category/intro/") . $data['images']['intro_image'] : '';
     $old_ori_detail_image_path = isset($data['images']['detail_image']) && $data['images']['detail_image'] ? JUDownloadFrontHelper::getDirectory("category_detail_image_directory", "media/com_judownload/images/category/detail/") . 'original/' . $data['images']['detail_image'] : '';
     $old_detail_image_path = $old_ori_detail_image_path ? JUDownloadFrontHelper::getDirectory("category_detail_image_directory", "media/com_judownload/images/category/detail/") . $data['images']['detail_image'] : '';
     foreach ($images as $key => $image) {
         if ($image['name']) {
             if (!in_array($image['type'], $mime_types)) {
                 $num_files_failed_mime_type++;
                 continue;
             }
             $info = pathinfo($image['name']);
             $replace = array('id' => $table->id, 'document' => '', 'category' => $table->title, 'image_name' => $info['filename']);
             $image['name'] = JUDownloadHelper::parseImageNameByTags($replace, 'category', $table->id, null) . '.' . $info['extension'];
             if ($key == 'intro' && $app->input->post->get('use_detail_image', 0) != 1) {
                 $new_ori_image_path = JUDownloadFrontHelper::getDirectory("category_intro_image_directory", "media/com_judownload/images/category/intro/") . 'original/' . $image['name'];
                 $new_image_path = JUDownloadFrontHelper::getDirectory("category_intro_image_directory", "media/com_judownload/images/category/intro/") . $image['name'];
                 if (!JFile::upload($image['tmp_name'], JPATH_ROOT . "/" . $new_ori_image_path) || !JUDownloadHelper::renderImages(JPATH_ROOT . "/" . $new_ori_image_path, JPATH_ROOT . "/" . $new_image_path, "category_intro", true, $table->id)) {
                     unset($images['intro']);
                 } else {
                     $delete_old_intro_image = $data['images']['intro_image'] && $data['images']['intro_image'] !== $image['name'] ? true : false;
                     $data['images']['intro_image'] = $image['name'];
                 }
                 if ($delete_old_intro_image) {
                     if ($old_intro_image_path && JFile::exists(JPATH_ROOT . "/" . $old_intro_image_path)) {
                         JFile::delete(JPATH_ROOT . "/" . $old_ori_intro_image_path);
                         JFile::delete(JPATH_ROOT . "/" . $old_intro_image_path);
                     }
                 }
             }
             if ($key == 'detail') {
                 $new_ori_image_path = JUDownloadFrontHelper::getDirectory("category_detail_image_directory", "media/com_judownload/images/category/detail/") . 'original/' . $image['name'];
                 $new_image_path = JUDownloadFrontHelper::getDirectory("category_detail_image_directory", "media/com_judownload/images/category/detail/") . $image['name'];
                 if (!JFile::upload($image['tmp_name'], JPATH_ROOT . "/" . $new_ori_image_path) || !JUDownloadHelper::renderImages(JPATH_ROOT . "/" . $new_ori_image_path, JPATH_ROOT . "/" . $new_image_path, "category_detail", true, $table->id)) {
                     unset($images['detail']);
                 } else {
                     if ($data['images']['detail_image'] && $data['images']['detail_image'] !== $image['name']) {
                         if ($old_detail_image_path && JFile::exists(JPATH_ROOT . "/" . $old_detail_image_path)) {
                             JFile::delete(JPATH_ROOT . "/" . $old_ori_detail_image_path);
                             JFile::delete(JPATH_ROOT . "/" . $old_detail_image_path);
                         }
                     }
                     $data['images']['detail_image'] = $image['name'];
                 }
             }
         }
     }
     if ($num_files_failed_mime_type) {
         JError::raise(E_NOTICE, 500, JText::plural('COM_JUDOWNLOAD_N_IMAGES_ARE_NOT_VALID_MIMETYPE', $num_files_failed_mime_type, implode(",", $mime_types)));
     }
     if ($app->input->post->get('use_detail_image', 0) == 1 && $data['images']['detail_image']) {
         $old_ori_detail_image_path = JUDownloadFrontHelper::getDirectory("category_detail_image_directory", "media/com_judownload/images/category/detail/") . 'original/' . $data['images']['detail_image'];
         $new_ori_intro_image_path = JUDownloadFrontHelper::getDirectory("category_intro_image_directory", "media/com_judownload/images/category/intro/") . 'original/' . $data['images']['detail_image'];
         $new_image_path = JUDownloadFrontHelper::getDirectory("category_intro_image_directory", "media/com_judownload/images/category/intro/") . $data['images']['detail_image'];
         if (JFile::copy(JPATH_ROOT . "/" . $old_ori_detail_image_path, JPATH_ROOT . "/" . $new_ori_intro_image_path) && JUDownloadHelper::renderImages(JPATH_ROOT . "/" . $new_ori_intro_image_path, JPATH_ROOT . "/" . $new_image_path, 'category_intro', true, $table->id)) {
             if ($data['images']['intro_image'] && $data['images']['intro_image'] !== $data['images']['detail_image']) {
                 if (JFile::exists(JPATH_ROOT . "/" . $old_ori_intro_image_path)) {
                     JFile::delete(JPATH_ROOT . "/" . $old_ori_intro_image_path);
                 }
                 if (JFile::exists(JPATH_ROOT . "/" . $old_intro_image_path)) {
                     JFile::delete(JPATH_ROOT . "/" . $old_intro_image_path);
                 }
             }
             $data['images']['intro_image'] = $data['images']['detail_image'];
         }
     }
     if (!empty($data['images'])) {
         $registry = new JRegistry();
         $registry->loadArray($data['images']);
         $table->images = (string) $registry;
         $table->store();
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:99,代码来源:category.php

示例3: resizeCollectionIcons

 public function resizeCollectionIcons($limitStart, $limit)
 {
     $db = JFactory::getDbo();
     $query = "SELECT icon FROM #__judownload_collections WHERE icon != ''";
     $db->setQuery($query, $limitStart, $limit);
     $images = $db->loadObjectList();
     if (count($images)) {
         $collection_icon_path = JPATH_ROOT . "/" . JUDownloadFrontHelper::getDirectory("collection_icon_directory", "media/com_judownload/images/collection/");
         foreach ($images as $image) {
             $ori_image_path = $collection_icon_path . "original/" . $image->icon;
             if (JFile::exists($ori_image_path)) {
                 $image_path = $collection_icon_path . $image->icon;
                 if (JFile::exists($image_path)) {
                     JFile::delete($image_path);
                 }
                 JUDownloadHelper::renderImages($ori_image_path, $image_path, 'collection');
             }
         }
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:20,代码来源:tools.php

示例4: storeValue

	public function storeValue($value, $type = 'default', $inputData = null)
	{
		if ($type == 'migrate')
		{
			
			$iconKeyArray = $this->getId() . "_icon";
			$icon         = $inputData[$iconKeyArray];

			
			$mime_types = array("image/jpeg", "image/pjpeg", "image/png", "image/gif", "image/bmp", "image/x-windows-bmp");
			if ($icon['name'])
			{
				if (in_array($icon['type'], $mime_types))
				{
					
					

					
					$iconDirectory  = JPATH_ROOT . "/" . JUDownloadFrontHelper::getDirectory("document_icon_directory", "media/com_judownload/images/document/");
					$icon_file_name = $this->doc_id . "_" . JUDownloadHelper::fileNameFilter($icon['name']);
					if (JFile::copy($icon['tmp_name'], $iconDirectory . "original/" . $icon_file_name)
						&& JUDownloadHelper::renderImages($iconDirectory . "original/" . $icon_file_name, $iconDirectory . $icon_file_name, 'doc_icon', true, null, $this->doc_id)
					)
					{
						$value = $icon_file_name;
						parent::storeValue($value, $type, $inputData);
					}
				}
			}
			elseif ($value == "" || strpos($value, 'default/') === 0)
			{
				if ($this->doc && $this->doc->icon && strpos($this->doc->icon, 'default/') === false)
				{
					$this->removeIcon();
				}
				parent::storeValue($value, $type, $inputData);
			}
		}
		else
		{
			$app = JFactory::getApplication();

			
			$icon = $app->input->files->get($this->getId() . "_icon");
			
			$mime_types = array("image/jpeg", "image/pjpeg", "image/png", "image/gif", "image/bmp", "image/x-windows-bmp");
			if ($icon['name'])
			{
				if (in_array($icon['type'], $mime_types))
				{
					
					$this->removeIcon();

					
					$iconDirectory  = JPATH_ROOT . "/" . JUDownloadFrontHelper::getDirectory("document_icon_directory", "media/com_judownload/images/document/");
					$icon_file_name = $this->doc_id . "_" . JUDownloadHelper::fileNameFilter($icon['name']);
					if (JFile::upload($icon['tmp_name'], $iconDirectory . "original/" . $icon_file_name)
						&& JUDownloadHelper::renderImages($iconDirectory . "original/" . $icon_file_name, $iconDirectory . $icon_file_name, 'doc_icon', true, null, $this->doc_id)
					)
					{
						$value = $icon_file_name;
						parent::storeValue($value, $type, $inputData);
					}
				}
				else
				{
					JError::raise(
						E_NOTICE,
						500,
						JText::sprintf('COM_JUDOWNLOAD_ICON_IS_NOT_VALID_MIME_TYPE')
					);
				}
			}
			elseif ($value == "" || strpos($value, 'default/') === 0)
			{
				if ($this->doc && $this->doc->icon && strpos($this->doc->icon, 'default/') === false)
				{
					$this->removeIcon();
				}
				parent::storeValue($value, $type, $inputData);
			}
		}
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:83,代码来源:core_icon.php

示例5: storeValue

	public function storeValue($value, $type = 'default', $inputData = null)
	{
		
		$gallery = $value;

		
		$date = JFactory::getDate();

		
		$image_ordering = 0;

		
		$configDocumentOriginalImageDirectory = JUDownloadFrontHelper::getDirectory("document_original_image_directory", "media/com_judownload/images/gallery/original/");
		$configDocumentSmallImageDirectory    = JUDownloadFrontHelper::getDirectory("document_small_image_directory", "media/com_judownload/images/gallery/small/");
		$configDocumentBigImageDirectory      = JUDownloadFrontHelper::getDirectory("document_big_image_directory", "media/com_judownload/images/gallery/big/");

		
		$document_original_image_directory = JPATH_ROOT . "/" . $configDocumentOriginalImageDirectory . $this->doc_id . "/";
		$document_small_image_directory    = JPATH_ROOT . "/" . $configDocumentSmallImageDirectory . $this->doc_id . "/";
		$document_big_image_directory      = JPATH_ROOT . "/" . $configDocumentBigImageDirectory . $this->doc_id . "/";

		
		JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judownload/tables', 'JUDownloadTable');
		$imageTable = JTable::getInstance('Image', 'JUDownloadTable');

		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($document_original_image_directory . $image['file_name']);
								JFile::delete($document_small_image_directory . $image['file_name']);
								JFile::delete($document_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 ($type == 'migrate')
		{
			$gallery['new'] = $inputData['new'];

			
			if (!empty($gallery['new']))
			{
				if (!JFolder::exists($document_original_image_directory))
				{
					$file_index = $document_original_image_directory . 'index.html';
					$buffer     = "<!DOCTYPE html><title></title>";
					JFile::write($file_index, $buffer);
				}

				if (!JFolder::exists($document_small_image_directory))
				{
					$file_index = $document_small_image_directory . 'index.html';
					$buffer     = "<!DOCTYPE html><title></title>";
					JFile::write($file_index, $buffer);
				}

				if (!JFolder::exists($document_big_image_directory))
				{
					$file_index = $document_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 = JUDownloadHelper::generateImageNameByDocument($this->doc_id, $image['name']);

					
					if (!JFile::copy($image['tmp_name'], $document_original_image_directory . $img_file_name)
						|| !JUDownloadHelper::renderImages($document_original_image_directory . $img_file_name, $document_small_image_directory . $img_file_name, 'document_small', true, null, $this->doc_id)
						|| !JUDownloadHelper::renderImages($document_original_image_directory . $img_file_name, $document_big_image_directory . $img_file_name, 'document_big', true, null, $this->doc_id)
					)
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:core_gallery.php


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