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


PHP EB::mediamanager方法代码示例

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


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

示例1: map

 public function map(&$file, $index, &$contents)
 {
     // Store the file to a temporary location
     $file['tmp_name'] = $this->tmp . '/' . md5($file['name']);
     JFile::write($file['tmp_name'], $file['data']);
     // Load up media manager now
     $mm = EB::mediamanager();
     $result = $mm->upload($file, 'user:' . $this->authorId);
     $title = $file['name'];
     $url = $this->absoluteUrl . '/' . $file['name'];
     // Get the properties from media manager result
     if (is_object($result) && property_exists($result, 'title')) {
         $title = $result->title;
         $url = $result->url;
     }
     // Once the attachment is already uploaded, we want to delete the temporary file now
     JFile::delete($file['tmp_name']);
     // Check if a file id is provided in the email
     if (isset($file['id']) && !empty($file['id'])) {
         $fileId = $file['id'];
         $fileId = str_replace('<', '', $fileId);
         $fileId = str_replace('>', '', $fileId);
         $patterns = array('/<div><img[^>]*src="[A-Za-z0-9:^>]*' . $fileId . '"[^>]*\\/><\\/div>/si', '/<img[^>]*src="[A-Za-z0-9:^>]*' . $fileId . '"[^>]*\\/>/si');
         $replace = array('', '');
         $contents = preg_replace($patterns, $replace, $contents);
     }
     // Now we need to insert the pdf links into the content
     $template = EB::template();
     $template->set('title', $title);
     $template->set('url', $url);
     $output = $template->output('site/mailpublishing/template.pdf');
     $contents .= $output;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:33,代码来源:pdf.php

示例2: map

 public function map(&$file, $index, &$contents)
 {
     // Get the attachment's extension
     $extension = JFile::getExt($file['name']);
     // Store the file to a temporary location
     $file['tmp_name'] = $this->tmp . '/' . md5($file['name']);
     JFile::write($file['tmp_name'], $file['data']);
     // Load up media manager now
     $mm = EB::mediamanager();
     $result = $mm->upload($file, 'user:' . $this->authorId);
     $title = $file['name'];
     $url = $this->absoluteUrl . '/' . $file['name'];
     // Get the properties from media manager result
     if (is_object($result) && property_exists($result, 'title')) {
         $title = $result->title;
         $url = $result->url;
     }
     // Since the image is already uploaded, we want to set the first image as the blog image
     if ($index == 0 && $this->config->get('main_remotepublishing_mailbox_blogimage')) {
         $blogimage = new stdClass();
         $blogimage->place = $result->place;
         $blogimage->path = $result->path;
         $this->blog->image = json_encode($blogimage);
     }
     // Once the attachment is already uploaded, we want to delete the temporary file now
     JFile::delete($file['tmp_name']);
     // Check if a file id is provided in the email
     if (isset($file['id']) && !empty($file['id'])) {
         $fileId = $file['id'];
         $fileId = str_replace('<', '', $fileId);
         $fileId = str_replace('>', '', $fileId);
         $patterns = array('/<div><img[^>]*src="[A-Za-z0-9:^>]*' . $fileId . '"[^>]*\\/><\\/div>/si', '/<img[^>]*src="[A-Za-z0-9:^>]*' . $fileId . '"[^>]*\\/>/si');
         $replace = array('', '');
         $contents = preg_replace($patterns, $replace, $contents);
     }
     // Now we need to insert these image tags into the content
     if ($index != 0 || !$this->config->get('main_remotepublishing_mailbox_blogimage')) {
         $template = EB::template();
         $template->set('title', $title);
         $template->set('url', $url);
         $contents .= $template->output('site/mailpublishing/template.image');
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:43,代码来源:image.php

示例3: upload

 /**
  * Handles uploads from media manager.
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function upload()
 {
     // Ensure that the user is logged in
     EB::requireLogin();
     // Only allowed users who are allowed to upload images
     if (!$this->acl->get('upload_image')) {
         $this->output(EB::exception('COM_EASYBLOG_NOT_ALLOWED', EASYBLOG_MSG_ERROR));
     }
     // Load up media manager
     $mm = EB::mediamanager();
     // Get uri
     $key = $this->input->getRaw('key');
     // Get the target folder
     $placeId = EBMM::getUri($key);
     // Get the file input
     $file = $this->input->files->get('file');
     // Check if the file is really allowed to be uploaded to the site.
     $state = EB::image()->canUploadFile($file);
     if ($state instanceof Exception) {
         return $this->output($state);
     }
     // MM should check if the user really has access to upload to the target folder
     $allowed = EBMM::hasAccess($placeId);
     if ($allowed instanceof Exception) {
         return $this->output($allowed);
     }
     // Check the image name is it got contain space, if yes need to replace to '-'
     $fileName = $file['name'];
     $file['name'] = str_replace(' ', '-', $fileName);
     // Upload the file now
     $file = $mm->upload($file, $placeId);
     // Response object is intended to also include
     // other properties like status message and status code.
     // Right now it only inclues the media item.
     $response = new stdClass();
     $response->media = EBMM::getMedia($file->uri);
     return $this->output($response);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:46,代码来源:media.php

示例4: uploadMedia

 /**
  * Stores the media object that is sent from the xmlrpc client
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public static function uploadMedia($blogid, $username, $password, $file)
 {
     global $xmlrpcerruser, $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble, $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
     // Login the user
     $state = self::login($username, $password);
     if ($state !== true) {
         return $state;
     }
     // Get the config
     $config = EB::config();
     // Get the user's acl
     $acl = EB::acl();
     // Get the current user
     $my = JFactory::getUser();
     // Check if user has permissions to upload images
     if (!$acl->get('upload_image')) {
         return new xmlrpcresp(0, $xmlrpcerruser + 2, JText::_('You do not have permissions to upload files to the site.'));
     }
     // Get the main image storage path
     $path = rtrim($config->get('main_image_path'), '/');
     $relativePath = $path . '/' . $my->id;
     $absolutePath = JPATH_ROOT . '/' . $path . '/' . $my->id;
     $absolutePath = JPath::clean($absolutePath);
     $absoluteUri = rtrim(JURI::root(), '/') . '/' . str_ireplace('\\', '/', $relativePath) . '/' . $my->id;
     // If the user's folder doesn't exist yet, create it first.
     if (!JFolder::exists($absolutePath)) {
         JFolder::create($absolutePath);
     }
     // Set the temporary folder
     $tmp = JPATH_ROOT . '/tmp';
     $mediamanager = EB::mediamanager();
     // Normalize the file name
     $file['name'] = $mediamanager->normalizeFileName($file['name']);
     // Write the file to the
     $tmpFile = $tmp . '/' . $file['name'];
     JFile::write($tmpFile, $file['bits']);
     // Enter some dummy data so we can run some sanity checks on the file
     $file['tmp_name'] = $tmpFile;
     $file['size'] = 0;
     $error = '';
     $allowed = EB::image()->canUploadFile($file, $error);
     // If file uploads aren't allowed for some reasons, we need to revert
     if ($allowed !== true) {
         JFile::delete($file['tmp_name']);
         return new xmlrpcresp(0, $xmlrpcerruser + 1, $error);
     }
     // Ensure that the image goes through the media manager resizing format
     $result = $mediamanager->upload($file);
     // Once it's gone through media manager, delete the temporary file
     JFile::delete($file['tmp_name']);
     // Build the url for the xmlrpc client so that they can replace the links accordingly within the content
     $url = rtrim(JURI::root(), '/') . '/' . $relativePath . '/' . $file['name'];
     return new xmlrpcresp(new xmlrpcval(array('url' => new xmlrpcval($url)), 'struct'));
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:62,代码来源:services.php

示例5: getImages

 /**
  * Given a json string, locate all images in the respective folder
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getImages($gallery)
 {
     // For posts created in 5.x with legacy editor
     if (isset($gallery->uri)) {
         $storage = EB::mediamanager()->getPath($gallery->uri);
         $url = EB::mediamanager()->getUrl($gallery->uri);
     }
     // For posts created in 3.x
     if (!isset($gallery->place) && !isset($gallery->uri)) {
         $storage = rtrim($this->config->get('main_image_path'), '/');
         $url = rtrim(JURI::root(), '/') . '/' . $storage . '/' . $userId . $gallery->path;
     }
     // For posts created in 3.x
     if (isset($gallery->place) && $gallery->place) {
         $folder = trim($gallery->file, '/\\');
         $storage = '';
         if ($gallery->place == 'shared') {
             $storage = JPATH_ROOT . '/' . $this->config->get('main_shared_path') . '/' . $folder;
             $url = rtrim(JURI::root(), '/') . '/' . $this->config->get('main_shared_path') . '/' . $folder;
         } else {
             // Get the user id
             $parts = explode(':', $gallery->place);
             $storage = JPATH_ROOT . '/' . rtrim($this->config->get('main_image_path'), '/') . '/' . $parts[1] . '/' . $folder;
             $url = rtrim(JURI::root(), '/') . '/' . rtrim($this->config->get('main_image_path'), '/') . '/' . $parts[1] . '/' . $folder;
         }
     }
     // Replace all / and \ from storage to the directory separator
     $storage = str_ireplace(array('\\', '/'), '/', $storage);
     // Let's test if the folder really exists.
     if (!JFolder::exists($storage)) {
         return false;
     }
     // Do not include image variations in the list.
     $exclusion = array(EBLOG_MEDIA_THUMBNAIL_PREFIX, EBLOG_BLOG_IMAGE_PREFIX . '_*', EBLOG_USER_VARIATION_PREFIX, EBLOG_SYSTEM_VARIATION_PREFIX);
     // Only allow specific file types here.
     $allowed = EBLOG_GALLERY_EXTENSION;
     // Get a list of images within this folder.
     $items = JFolder::files($storage, $allowed, false, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'index.html'), $exclusion);
     $images = array();
     if ($items) {
         foreach ($items as $item) {
             $block = new stdClass();
             $block->nested = true;
             $block->isolated = true;
             $block->data = new stdClass();
             $block->data->width = "100%";
             $block->data->element_width = "100%";
             // Get the meta about the image
             $imageMeta = $this->getImageMeta($storage, $url, $item);
             $block->data->url = $imageMeta->thumbnail;
             $block->data->popup_url = $imageMeta->original;
             $images[] = $block;
         }
     }
     return $images;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:64,代码来源:gallery.php

示例6: bindWebcam

 /**
  * Binds the user's webcam photo
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function bindWebcam(EasyBlogPost &$blog)
 {
     // Get the title
     $title = $this->input->get('title', '', 'default');
     if (!$title) {
         $post->title = JText::_('COM_EASYBLOG_DEFAULT_WEBCAM_PHOTO_TITLE');
     }
     $fileName = $this->input->get('fileName', '', 'default');
     $tmpPath = JPATH_ROOT . '/tmp/' . $fileName;
     $tmpPath = JPath::clean($tmpPath);
     // Construct a dummy file object
     $file = array('name' => $fileName, 'tmp_name' => $tmpPath);
     // Upload this file into the user's images folder.
     // Load up media manager now
     $mm = EB::mediamanager();
     $result = $mm->upload($file, 'user:' . $this->my->id);
     $post->image = $result->uri;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:26,代码来源:photo.php

示例7: uploadAudio

 /**
  * Allows uploading of an audio file to the server temporarily.
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function uploadAudio()
 {
     // Check for request forgeries
     // EB::checkToken();
     // Ensure that the user is logged in
     EB::requireLogin();
     // Ensure that the user really has permissions to create blog posts on the site
     if (!$this->acl->get('add_entry')) {
         EB::exception('COM_EASYBLOG_NO_PERMISSION_TO_CREATE_BLOG', EASYBLOG_MSG_ERROR)->setGlobal();
         return $this->ajax->reject();
     }
     $file = $this->input->files->get('file');
     if (!isset($file['tmp_name']) || empty($file['tmp_name'])) {
         echo JText::_("COM_EASYBLOG_COMPOSER_UNABLE_TO_LOCATE_TEMPORARY_FILE");
         exit;
     }
     // Upload this file into their respective images folder.
     $mm = EB::mediamanager();
     $path = $mm->getAbsolutePath('/', 'user:' . $this->my->id);
     $uri = $mm->getAbsoluteURI('/', 'user:' . $this->my->id);
     $result = $mm->upload($file, 'user:' . $this->my->id);
     // Get the audio player which needs to be embedded on the composer.
     $player = EB::audio()->getPlayer($result->url);
     $obj = new stdClass();
     $obj->title = $result->title;
     $obj->player = $player;
     $obj->file = $result->url;
     $obj->path = $result->path;
     echo json_encode($obj);
     exit;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:39,代码来源:view.ajax.php

示例8: createVariation

 /**
  * Creates a new variation on the site
  *
  * @since   5.0
  * @access  public
  * @param   string
  * @return
  */
 public function createVariation()
 {
     $name = $this->input->getCmd('name');
     $key = $this->input->getRaw('key');
     // Convert the key into uri
     $uri = EBMM::getUri($key);
     // Get the width and height
     $width = $this->input->get('width');
     $height = $this->input->get('height');
     $params = new stdClass();
     $params->width = $width;
     $params->height = $height;
     $media = EB::mediamanager();
     $item = $media->createVariation($uri, $name, $params);
     if ($item instanceof EasyBlogException) {
         return $this->ajax->reject($state);
     }
     // Response object is intended to also include
     // other properties like status message and status code.
     // Right now it only inclues the media item.
     $info = EBMM::getMedia($uri);
     return $this->ajax->resolve($info);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:31,代码来源:view.ajax.php

示例9: getImage

 /**
  * Retrieves the blog image for this blog post
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getImage($size = 'original', $showPlaceholder = true, $protocol = false)
 {
     static $cache = array();
     $index = $this->id . '-' . $size . $protocol;
     // Default blog image
     $default = false;
     // Display a default place holder
     if ($showPlaceholder) {
         $default = EB::getPlaceholderImage();
     }
     if (!isset($cache[$index])) {
         // If there's no image data for this post, skip this altogether
         if (!$this->image) {
             $cache[$index] = $default;
             return $cache[$index];
         }
         // Ensure that the image is normalized
         $this->normalizeBlogImage();
         // Load up the media manager library
         $mm = EB::mediamanager();
         $url = $mm->getUrl($this->image);
         $path = $mm->getPath($this->image);
         $fileName = $mm->getFilename($this->image);
         // Ensure that the item really exist before even going to do anything on the original image.
         // If the image was manually removed from FTP or any file explorer, this shouldn't yield any errors.
         $exists = JFile::exists($path);
         // If the blog image file doesn't exist, we use the default
         if (!$exists) {
             $cache[$index] = $default;
             return $cache[$index];
         }
         $image = EB::blogimage($path, $url);
         $cache[$index] = $image->getSource($size, false, $protocol);
     }
     return $cache[$index];
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:44,代码来源:post.php

示例10: uploadImage

 public function uploadImage($key)
 {
     // Load up media manager
     $mm = EB::mediamanager();
     // Get the target folder
     $placeId = EBMM::getUri($key);
     // Get the file input
     $file = JRequest::getVar('file', '', 'FILES', 'array');
     // Check if the file is really allowed to be uploaded to the site.
     $state = EB::image()->canUploadFile($file);
     if ($state instanceof Exception) {
         //add error code
         return $state;
         //return $this->output($state);
     }
     // MM should check if the user really has access to upload to the target folder
     $allowed = EBMM::hasAccess($placeId);
     if ($allowed instanceof Exception) {
         //add error code
         return $state;
         //return $this->output($allowed);
     }
     // Check the image name is it got contain space, if yes need to replace to '-'
     $fileName = $file['name'];
     $file['name'] = str_replace(' ', '-', $fileName);
     // Upload the file now
     $file = $mm->upload($file, $placeId);
     // Response object is intended to also include
     // other properties like status message and status code.
     // Right now it only inclues the media item.
     $response = new stdClass();
     $response->media = EBMM::getMedia($file->uri);
     //code for future use
     //header('Content-type: text/x-json; UTF-8');
     //$resp =  json_encode($response, JSON_HEX_TAG);
     return $response;
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:37,代码来源:blog.php

示例11: processUploadedVideos

 /**
  * Search and replace videos that are uploaded to the site.
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function processUploadedVideos($content, $isPlain = false, $findText = '', $result = '')
 {
     $cfg = EB::config();
     // Since 3.0 uses a different video format, we need to do some tests here.
     if ($result) {
         $data = json_decode($result);
         // New EasyBlog 5 legacy codes
         if (isset($data->uri)) {
             $mm = EB::mediamanager();
             $file = $mm->getFile($data->uri);
             $url = $file->url;
         } else {
             // This is the video codes used on EB3.9 or older
             $file = trim($data->file, '/\\');
             $place = $data->place;
             if ($place == 'shared') {
                 $url = rtrim(JURI::root(), '/') . '/' . trim(str_ireplace('\\', '/', $cfg->get('main_shared_path')), '/\\') . '/' . $file;
             } else {
                 $place = explode(':', $place);
                 $url = rtrim(JURI::root(), '/') . '/' . trim($cfg->get('main_image_path'), '/\\') . '/' . $place[1] . '/' . $file;
             }
         }
         $options = array();
         $options['width'] = $data->width;
         $options['height'] = $data->height;
         $options['autostart'] = isset($data->autostart) ? $data->autostart : false;
         $player = EB::media()->renderVideoPlayer($url, $options);
         $content = str_ireplace($findText, $player, $content);
         return $content;
     }
     return $content;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:40,代码来源:videos.php

示例12: mediaConfiguration

 /**
  * Load media configuration
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function mediaConfiguration()
 {
     $ajax = EB::ajax();
     // Require login
     EB::requireLogin();
     $user = EB::user($this->my->id);
     $tpl = EB::template();
     $blogger_id = $user->id;
     $tpl->set('blogger_id', $blogger_id);
     // @since: 3.6
     // Media manager options
     $tpl->set('session', JFactory::getSession());
     $mediamanager = EB::mediamanager();
     $userFolders = $mediamanager->getInfo(EasyBlogMediaManager::getAbsolutePath('', 'user'), 'folders');
     $userFiles = $mediamanager->getInfo(EasyBlogMediaManager::getAbsolutePath('', 'user'), 'files');
     $sharedFolders = $mediamanager->getInfo(EasyBlogMediaManager::getAbsolutePath('', 'shared'), 'folders');
     $sharedFiles = $mediamanager->getInfo(EasyBlogMediaManager::getAbsolutePath('', 'shared'), 'files');
     $tpl->set('userFolders', $userFolders);
     $tpl->set('userFiles', $userFiles);
     $tpl->set('sharedFolders', $sharedFolders);
     $tpl->set('sharedFiles', $sharedFiles);
     // @rule: Test if the user is already associated with Flickr
     $oauth = EB::table('OAuth');
     $associated = $oauth->loadByUser($this->my->id, EBLOG_OAUTH_FLICKR);
     $tpl->set('flickrAssociated', $associated);
     // Retrieve flickr's data
     $flickr = $this->getFlickrData();
     // Retrieve dropbox's data
     $dropbox = $this->getDropboxData();
     $tpl->set('flickr', $flickr);
     $tpl->set('dropbox', $dropbox);
     $html = $tpl->output('site/media/configuration');
     $ajax->resolve($html);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:42,代码来源:view.ajax.php

示例13: migrateZooImages

 public function migrateZooImages($path, &$blog, $author)
 {
     jimport('joomla.filesystem.file');
     $path = JPATH_ROOT . '/' . $path;
     $config = EB::getConfig();
     $configStorage = str_ireplace('\\', '/', $config->get('main_image_path'));
     $newPath = JPATH_ROOT . '/' . rtrim($configStorage, '/') . '/' . $author->id;
     if (!JFolder::exists($newPath)) {
         JFolder::create($newPath);
     }
     if (JFile::exists($path)) {
         // Copy the full scaled image
         $large = $path;
         $targetURL = rtrim(JURI::root(), '/') . '/' . str_ireplace('\\', '/', $configStorage) . '/' . $author->id;
         $file = getimagesize($large);
         $file['name'] = basename($large);
         $file['tmp_name'] = $large;
         $result = EB::mediamanager()->upload($file, 'user:' . $author->id);
         if (isset($result->type)) {
             $relativeImagePath = $newPath . '/' . $file['name'];
             $result->path = $relativeImagePath;
         }
         $result = json_encode($result);
         $blog->image = $result;
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:26,代码来源:zoo.php

示例14: defined

<?php

/**
* @package      EasyBlog
* @copyright    Copyright (C) 2010 - 2015 Stack Ideas Sdn Bhd. All rights reserved.
* @license      GNU/GPL, see LICENSE.php
* EasyBlog is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');
?>
<div class="eb-composer-view eb-composer-media" data-name="media" data-eb-composer-view data-eb-composer-media>
    <?php 
echo EB::mediamanager()->render();
?>
</div>
开发者ID:knigherrant,项目名称:decopatio,代码行数:19,代码来源:media.php

示例15: migrateBloggerImage

 function migrateBloggerImage($image, $userid, $content)
 {
     jimport('joomla.utilities.error');
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $config = EB::getConfig();
     $main_image_path = $config->get('main_image_path');
     $main_image_path = rtrim($main_image_path, '/');
     $rel_upload_path = $main_image_path . '/' . $userid;
     $userUploadPath = JPATH_ROOT . DIRECTORY_SEPARATOR . str_ireplace('/', DIRECTORY_SEPARATOR, $main_image_path . DIRECTORY_SEPARATOR . $userid);
     $folder = JPath::clean($userUploadPath);
     $dir = $userUploadPath . DIRECTORY_SEPARATOR;
     $tmp_dir = JPATH_ROOT . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR;
     if (!JFolder::exists($dir)) {
         JFolder::create($dir);
     }
     //now let get the image from remove url.
     $segments = explode('/', $image);
     $fileName = $segments[count($segments) - 1];
     $fileName = JFile::makesafe($fileName);
     $tmpFileName = $tmp_dir . $fileName;
     $file['name'] = $fileName;
     $file['tmp_name'] = $tmpFileName;
     // write to JOOMLA tmp folder
     file_put_contents($tmpFileName, file_get_contents($image));
     $media = EB::mediamanager();
     $result = $media->upload($file, 'user:' . $userid);
     @JFile::delete($file['tmp_name']);
     if (isset($result->type)) {
         $relativeImagePath = $rel_upload_path . '/' . $file['name'];
         // lets replace the image from the content to this uploaded one.
         $content = str_replace($image, $relativeImagePath, $content);
     }
     return $content;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:35,代码来源:blogger_xml.php


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