Skip to content

Commit

Permalink
Merge pull request #1 from LadySolveig/master
Browse files Browse the repository at this point in the history
Update jpeljpeg.php
  • Loading branch information
dmitriitux authored Jul 18, 2022
2 parents 5b97afe + 0af5ebb commit 6ad2e0f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions jpeljpeg.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

defined('_JEXEC') or die;

use Joomla\CMS\Version;
use lsolesen\pel\PelDataWindow;
use lsolesen\pel\PelEntryAscii;
use lsolesen\pel\PelEntryUndefined;
Expand Down Expand Up @@ -41,7 +42,15 @@ class JPelJpeg implements JPelInterface
*/
public function __construct($file)
{
JLoader::registerNamespace('lsolesen\pel', JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'jpel');
$jversion = new Version();
if (version_compare($jversion->getShortVersion(), '4.0', '<')) {
// only for Joomla 3.x
JLoader::registerNamespace('lsolesen\pel', JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'jpel');

} else {
// only for Joomla 4.x
JLoader::registerNamespace('lsolesen\pel', JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'jpel'. DIRECTORY_SEPARATOR . 'lsolesen'. DIRECTORY_SEPARATOR . 'pel');
}
$data = new PelDataWindow(file_get_contents($file));

$this->file = $file;
Expand Down Expand Up @@ -152,4 +161,4 @@ public function save($file)
$this->jpeg->saveFile($file);
}

}
}

0 comments on commit 6ad2e0f

Please sign in to comment.