Server : LiteSpeed System : Linux server 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : alsaif ( 1057) PHP Version : 7.4.33 Disable Function : show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/alsaif/public_html/components/com_sppagebuilder/views/media/tmpl/ |
<?php
/**
* @package SP Page Builder
* @author JoomShaper http://www.joomshaper.com
* @copyright Copyright (c) 2010 - 2022 JoomShaper
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
*/
//no direct accees
defined('_JEXEC') or die ('Restricted access');
$input = JFactory::getApplication()->input;
$path = $input->post->get('path', '/images', 'PATH');
$media = $this->media;
$report['folders'] = $media['folders'];
$report['folders_list'] = $media['folders_list'];
$images = array();
foreach ($media['images'] as $key => $image) {
$image = str_replace('\\', '/',$image);
$root_path = str_replace('\\', '/', JPATH_ROOT);
$path = str_replace($root_path . '/', '', $image);
$images[$key]['path'] = $path;
$thumb = dirname($path) . '/_sp-pagebuilder_thumbs/' . basename($path);
if(file_exists(JPATH_ROOT . '/' . $thumb)) {
$images[$key]['src'] = JURI::root(true) . '/' . $thumb;
} else {
$images[$key]['src'] = JURI::root(true) . '/' . $path;
}
$filename = basename($image);
$title = JFile::stripExt($filename);
$ext = JFile::getExt($filename);
$images[$key]['title'] = $title;
$images[$key]['ext'] = $ext;
}
$report['images'] = $images;
echo json_encode($report); die;