Error in SP Image Gallery 2.1.0 - Forum | JoomShaper
Solved Extensions

Error in SP Image Gallery 2.1.0

Asked by Manuel Valentin 10 months ago Last activity 8 months ago

Hello,
after updating SP Image Gallery to 2.1.0, on a Joomla 4.4.14 installation, when I open the "Albums" page on the backend, I get the following error: Call to undefined method Joomla\Filesystem\File::getExt().

This error was not present in the previous version of SP Image Gallery.

Is it possible to fix this, since the extension is declared compatible with Joomla 4?

Thank you

Accepted answer

Marked as the solution
Ziaul Kabir Staff

Issues is resolved, I have modify this file:

JRoot/administrator/components/com_speasyimagegallery/views/albums/tmpl/default.php

Thanks

Olivier DELORON

Hello Ziaul,

What have you modified in this file?...

Regards

8 more replies

Ziaul Kabir Staff

Hello,

Please, replace your current code with this, it will fix your issues.

File path: JRoot/plugins/system/helixultimate/src/fields/heliximage.php

Upcoming release will fix this issues permanently.

<?php
/**
 * @package Helix_Ultimate_Framework
 * author JoomShaper <[email protected]>
 * copyright Copyright (c) 2010 - 2025 JoomShaper
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
 */
defined('_JEXEC') or die();
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\HTML\HTMLHelper;
/**
 * Form field for Helix image.
 *
 * @since       1.0.0
 * @deprecated  3.0     Use the Same Class from the src/fields instead.
 */
class JFormFieldHeliximage extends FormField
{
    /**
     * Field type
     *
     * @var     string  $type
     * @since   1.0.0
     */
    protected $type = 'Heliximage';
    /**
     * Override getInput function from FormField
     *
     * @return  string  Field HTML string
     * @since   1.0.0
     */
    protected function getInput()
    {
        $doc = Factory::getDocument();
        HTMLHelper::_('jquery.framework');
        $plg_path = Uri::root(true) . '/plugins/system/helixultimate';
        $class = ' hu-image-field-empty';
        if ($this->value)
        {
            $class = ' hu-image-field-has-image';
        }
        $output  = '<div class="hu-image-field' . $class . ' clearfix">';
        $output .= '<div class="hu-image-upload-wrapper">';
        if ($this->value)
        {
            $data_src = $this->value;
            $src = Uri::root(true) . '/' . $data_src;
            $basename = basename($data_src);
            // Joomla 4.4 fix: replace deprecated File::getExt
            $extension = pathinfo($basename, PATHINFO_EXTENSION);
            $filenameWithoutExt = File::stripExt($basename);
            $thumbnail = JPATH_ROOT . '/' . dirname($data_src) . '/' . $filenameWithoutExt . '_thumbnail.' . $extension;
            if (file_exists($thumbnail))
            {
                $src = Uri::root(true) . '/' . dirname($data_src) . '/' . $filenameWithoutExt . '_thumbnail.' . $extension;
            }
            $output .= '<img src="' . $src . '" data-src="' . $data_src . '" alt="">';
        }
        $output .= '</div>';
        $output .= '<input type="file" class="hu-image-upload" accept="image/*" style="display:none;">';
        $output .= '<a class="btn btn-primary btn-hu-image-upload" href="#"><i class="fas fa-plus" aria-hidden="true"></i> ' . Text::_('HELIX_ULTIMATE_UPLOAD_IMAGE') . '</a>';
        $output .= '<a class="btn btn-danger btn-hu-image-remove" href="#"><i class="fas fa-minus-circle" aria-hidden="true"></i> ' . Text::_('HELIX_ULTIMATE_REMOVE_IMAGE') . '</a>';
        $output .= '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . htmlspecialchars($this->value ?? "", ENT_COMPAT, 'UTF-8')
                . '"  class="form-field-hu-image">';
        $output .= '</div>';
        return $output;
    }
}

Thanks,

Manuel Valentin Asked this

Hello,
I tried this but it seems not to resolve the error in SP Image Gallery.

Ziaul Kabir Staff

Could you please share temporary administrator access to your Joomla backend? You can provide the credentials securely in the hidden content section. Also, please take a full backup of your site before we make any changes.

Once I have access, I’ll investigate further and see what’s causing the issue. Let me know once you’ve shared the details!

Best regards,

Manuel Valentin Asked this

Hello,
here is the login information.

Thanks

Ziaul Kabir Staff

I see the issues, Please, give me your cPanel access in hidden content section to fix this issues.

Thanks

Manuel Valentin Asked this

Hello,
thanks for checking it.
I don't have a direct administration panel access, but I am sending you here an FTP access, I hope that works out for you.

Please let me know which files you will modify, so that I can avoid overwriting them during updates or other actions.
Thank you!

Manuel Valentin Asked this

Thank you for the assistance

Dave

Hi Ziaul,

I have the exact same issue.

Call to undefined method Joomla\Filesystem\File::getExt()

So what is the fix to the JRoot/administrator/components/com_speasyimagegallery/views/albums/tmpl/default.php file?

If you can post the code I can update my system.

Thanks

Ziaul Kabir Staff

Please, replace this file with this:

<?php
/**
 * @package com_speasyimagegallery
 * @author JoomShaper http://www.joomshaper.com
 * @copyright Copyright (c) 2010 - 2021 JoomShaper
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted Access');

use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Layout\LayoutHelper;

if (SpeasyimagegalleryHelper::getVersion() < 4)
{
    HTMLHelper::_('formbehavior.chosen', 'select');
}

$user       = Factory::getUser();
$userId     = $user->get('id');
$listOrder = $this->escape($this->filter_order);
$listDirn = $this->escape($this->filter_order_Dir);
$saveOrder = $listOrder == 'a.ordering';

if ($saveOrder && !empty($this->items))
{
    if (SpeasyimagegalleryHelper::getVersion() < 4)
    {
        $saveOrderingUrl = 'index.php?option=com_speasyimagegallery&task=albums.saveOrderAjax&tmpl=component';
        HTMLHelper::_('sortablelist.sortable', 'albumList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
    }
    else 
    {
        $saveOrderingUrl = 'index.php?option=com_speasyimagegallery&task=albums.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
        HTMLHelper::_('draggablelist.draggable');
    }
}
?>


<script type="text/javascript">
    window.addEventListener('DOMContentLoaded', e => {
        Joomla.orderTable = function() {
            table = document.getElementById("sortTable");
            direction = document.getElementById("directionTable");
            order = table.options[table.selectedIndex].value;
            if (order != '<?php echo $listOrder; ?>')
            {
                dirn = 'asc';
            } else {
                dirn = direction.options[direction.selectedIndex].value;
            }
            Joomla.tableOrdering(order, dirn, '');
        }
    });

</script>

<form action="<?php echo Route::_('index.php?option=com_speasyimagegallery&view=albums'); ?>" method="post" id="adminForm" name="adminForm">

    <?php if (JVERSION < 4 && !empty($this->sidebar)) : ?>
        <div id="j-sidebar-container" class="span2">
            <?php echo $this->sidebar; ?>
        </div>
        <div id="j-main-container" class="span10">
    <?php else : ?>
        <div id="j-main-container">
    <?php endif; ?>

        <?php echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>


        <?php if (empty($this->items)) : ?>
            <?php if (SpeasyimagegalleryHelper::getVersion() < 4) :?>
            <div class="alert alert-no-items">
                <?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
            </div>
            <?php else : ?>
                <div class="alert alert-info">
                    <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
                    <?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
                </div>
            <?php endif; ?>
        <?php else : ?>
            <table class="table table-striped" id="albumList">
                <thead>
                <tr>
                    <th width="2%" class="nowrap center hidden-phone">
                        <?php echo HtmlHelper::_('grid.sort', '<i class="icon-menu-2"></i>', 'a.ordering', $listDirn, $listOrder); ?>
                    </th>
                    <th width="2%" class="hidden-phone">
                        <?php echo HtmlHelper::_('grid.checkall'); ?>
                    </th>
                    <th width="10%">
                        <?php echo Text::_('COM_SPEASYIMAGEGALLERY_HEADING_IMAGE'); ?>
                    </th>
                    <th>
                        <?php echo HtmlHelper::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
                    </th>
                    <th width="10%" class="nowrap hidden-phone">
                        <?php echo HtmlHelper::_('grid.sort',  'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
                    </th>
                    <th width="10%" class="nowrap hidden-phone">
                        <?php echo HtmlHelper::_('grid.sort',  'JAUTHOR', 'a.created_by', $listDirn, $listOrder); ?>
                    </th>
                    <th width="10%" class="nowrap hidden-phone">
                        <?php echo HtmlHelper::_('grid.sort', 'COM_SPEASYIMAGEGALLERY_HEADING_DATE_CREATED', 'a.created', $listDirn, $listOrder); ?>
                    </th>
                    <th width="5%" class="nowrap hidden-phone">
                        <?php echo HtmlHelper::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder); ?>
                    </th>
                    <th width="1%" class="nowrap hidden-phone">
                        <?php echo HtmlHelper::_('grid.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
                    </th>
                    <th width="1%" class="nowrap center">
                        <?php echo HtmlHelper::_('grid.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
                    </th>
                    <th width="1%" class="nowrap hidden-phone">
                        <?php echo HtmlHelper::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
                    </th>
                </tr>
                </thead>

                <tfoot>
                    <tr>
                        <td colspan="12">
                            <?php echo $this->pagination->getListFooter(); ?>
                        </td>
                    </tr>
                </tfoot>

                    <?php if (SpeasyimagegalleryHelper::getVersion() < 4) :?>
                        <tbody>
                    <?php else: ?>
                        <tbody <?php if ($saveOrder) :?> class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="false"<?php endif; ?>>
                    <?php endif; ?>
                    <?php if (!empty($this->items)) : ?>
                        <?php foreach ($this->items as $i => $item) :
                            $item->max_ordering = 0;
                            $ordering   = ($listOrder == 'a.ordering');
                            $canEdit    = $user->authorise('core.edit', 'com_speasyimagegallery.album.' . $item->id) || ($user->authorise('core.edit.own',   'com_speasyimagegallery.album.' . $item->id) && $item->created_by == $userId);
                            $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
                            $canChange  = $user->authorise('core.edit.state', 'com_speasyimagegallery.album.' . $item->id) && $canCheckin;
                            $link = Route::_('index.php?option=com_speasyimagegallery&task=album.edit&id=' . $item->id);
                        ?>
                            <?php if(SpeasyimagegalleryHelper::getVersion() < 4) :?>
                                <tr>
                            <?php else: ?>
                                <tr class="row<?php echo $i % 2; ?>" data-draggable-group="1">
                            <?php endif; ?>
                                <td class="order nowrap center hidden-phone">
                                    <?php
                                    $iconClass = '';
                                    if (!$canChange)
                                    {
                                        $iconClass = ' inactive';
                                    }
                                    elseif (!$saveOrder)
                                    {
                                        $iconClass = ' inactive tip-top hasTooltip" title="' . HtmlHelper::tooltipText('JORDERINGDISABLED');
                                    }
                                    ?>
                                    <span class="sortable-handler<?php echo $iconClass ?>">
                                        <span class="icon-menu"></span>
                                    </span>
                                    <?php if ($canChange && $saveOrder) : ?>
                                        <input type="text" style="display:none" name="order[]" size="5" value="<?php echo $item->ordering; ?>" class="width-20 text-area-order " />
                                    <?php endif; ?>
                                </td>
                                <td class="hidden-phone">
                                    <?php echo HtmlHelper::_('grid.id', $i, $item->id); ?>
                                </td>
                                <td>
                                        <?php $ext = pathinfo($item->image, PATHINFO_EXTENSION); ?>
                                        <img src="/<?php echo Uri::root(true) . '/images/speasyimagegallery/albums/' . $item->id . '/thumb.' . $ext; ?>" alt="" style="width: 64px; height: 64px; border: 1px solid #e5e5e5; background-color: #f5f5f5;">
                                </td>
                                <td>
                                    <?php if ($item->checked_out) : ?>
                                        <?php echo HtmlHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'albums.', $canCheckin); ?>
                                    <?php endif; ?>

                                    <?php if ($canEdit) : ?>
                                        <a class="sp-easy-image-gallery-title" href="/<?php echo Route::_('index.php?option=com_speasyimagegallery&task=album.edit&id='.$item->id);?>">
                                            <?php echo $this->escape($item->title); ?>
                                        </a>
                                    <?php else : ?>
                                        <?php echo $this->escape($item->title); ?>
                                    <?php endif; ?>

                                    <span class="small break-word">
                                        <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
                                    </span>
                                    <?php if($item->catid) : ?>
                                    <div class="small">
                                        <?php echo Text::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?>
                                    </div>
                                    <?php endif; ?>
                                </td>
                                <td class="hidden-phone">
                                    <?php echo $this->escape($item->access_title); ?>
                                </td>
                                <td class="small hidden-phone">
                                        <a class="hasTooltip" href="/<?php echo Route::_('index.php?option=com_users&task=user.edit&id=' . (int) $item->created_by); ?>" title="<?php echo Text::_('JAUTHOR'); ?>">
                                        <?php echo $this->escape($item->author_name); ?></a>
                                </td>
                                <td class="nowrap small hidden-phone">
                                    <?php
                                    echo $item->created > 0 ? HtmlHelper::_('date', $item->created, Text::_('DATE_FORMAT_LC4')) : '-';
                                    ?>
                                </td>
                                <td class="small nowrap hidden-phone">
                                    <?php if ($item->language == '*') : ?>
                                        <?php echo Text::alt('JALL', 'language'); ?>
                                    <?php else:?>
                                        <?php echo $item->language_title ? $this->escape($item->language_title) : Text::_('JUNDEFINED'); ?>
                                    <?php endif;?>
                                </td>
                                <td class="center hidden-phone">
                                    <span class="badge badge-info">
                                        <?php echo (int) $item->hits; ?>
                                    </span>
                                </td>

                                <td class="center">
                                    <?php echo HtmlHelper::_('jgrid.published', $item->published, $i, 'albums.', $canChange);?>
                                </td>

                                <td align="center" class="hidden-phone">
                                    <?php echo $item->id; ?>
                                </td>
                            </tr>
                        <?php endforeach; ?>
                    <?php endif; ?>
                </tbody>
            </table>
        <?php endif; ?>
    </div>

    <input type="hidden" name="task" value="" />
    <input type="hidden" name="boxchecked" value="0" />
    <input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
    <input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
    <?php echo HTMLHelper::_('form.token'); ?>
</form>

Thanks

Shana

Hi Ziaul,
I have the exact same issue and I replaced the default.php file with the code you placed above but it does not work. Please help.

Log in to reply.