joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.69k stars 3.63k forks source link

J 4.0.2 cant find GD library when using the template editor. #35386

Closed gwstyles closed 2 years ago

gwstyles commented 2 years ago

Try editing images in J 4 template editor.

While testing the template editor in j4.0.2 I can not see the svg images.The screen shot shows that J4 thinks I do not have the GD library available ,but it is? Is this a bug or does it work for you? Also the documentation button goes to J3 info not J4.

Expected result It works

Actual result see imagesscreen shot 2021-08-26 at 16 43 38

System information (as much as possible)

Site Information

Setting     Value

PHP Built On Linux manganese.cloudhosting.co.uk 4.18.0-305.10.2.2.lve.el7h.x86_64 #1 SMP Wed Jul 28 13:09:44 UTC 2021 x86_64 Database Type mysql Database Version 10.3.30-MariaDB-log-cll-lve Database Collation latin1_swedish_ci Database Connection Collation utf8mb4_general_ci Database Connection Encryption None Database Server Supports Connection Encryption No PHP Version 8.0.9 Web Server LiteSpeed WebServer to PHP Interface litespeed Joomla! Version Joomla! 4.0.2 Stable [ Furaha ] 24-August-2021 19:54 GMT User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Articles

Additional comments

screen shot 2021-08-26 at 16 43 40

brianteeman commented 2 years ago

Could you upload larger images please.

wojsmol commented 2 years ago

@brianteeman On screan shot posted by @gwstyles there's visible COM_TEMPLATES_GD_EXTENSION_NOT_AVAILABLE message.

PhilETaylor commented 2 years ago

More of my shit code. https://github.com/joomla/joomla-cms/commit/a1ab74a3467da5c6b0e20cab4969e1d05b1247e6

System Information reads from extension_loaded('gd') this is correct.

Template manager is not checking for GD, its using COM_TEMPLATES_GD_EXTENSION_NOT_AVAILABLE as a placeholder when handling ANY RuntimeException ... could literally be any exception and it will just say that GD is not available.

Extract the following Zip file, and then Upload the file it contains to /administrator/components/com_templates/src/View/Template/HtmlView.php and try again and report back what the message is that is shown this time please.

HtmlView.php.zip

gwstyles commented 2 years ago

Do you need larger images or is it ok?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35386.

PhilETaylor commented 2 years ago

I dont need larger images. Just follow the instructions I have provided and provide the messages that this dumps to the screen when you try.

gwstyles commented 2 years ago

I cant paste it here? see attached.error message.txt


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35386.

PhilETaylor commented 2 years ago

well that comes from getimagesize() PHP function which Joomla throws a UnparsableImageException Exception for which implements RuntimeException

Which image are you trying to edit? Can you upload that EXACT image here please.

gwstyles commented 2 years ago

Cant upload a svg, change jpg to .svg


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35386.

PhilETaylor commented 2 years ago

You cannot edit SVG Files with Joomla's template manager The only formats supported are

    static::$formats[IMAGETYPE_JPEG] = $info['JPEG Support'];
            static::$formats[IMAGETYPE_PNG]  = $info['PNG Support'];
            static::$formats[IMAGETYPE_GIF]  = $info['GIF Read Support'];
            static::$formats[IMAGETYPE_WEBP] = $info['WebP Support'];
gwstyles commented 2 years ago

JPG extension tells me invalid mime type, so I have changed it to txt. First time on git and a bit odd for an old git...screen shot 2021-08-26 at 18 14 42


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35386.

PhilETaylor commented 2 years ago

SVG is not "really" an image. It is an XML file - this is why GD gets confused. I'll write some code to catch this over the weekend.

gwstyles commented 2 years ago

OK that dont work,how do you upload an svg image to git?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35386.

PhilETaylor commented 2 years ago

You dont need to upload the SVG, I have already told you the problem and the solution.

Problem: SVG is not an image type. You are trying to edit a SVG. Joomla is not stopping you (it should) and passes the SVG to GD which complains when running getimagesize() function

Solution: You cannot edit SVG in Joomla Template Manager. We also need to improve Joomla 4 to not allow you to attempt to, and to show you error messages like "You cannot edit SVG files in Joomla admin".

gwstyles commented 2 years ago

OK its not a bug then just not designed to do this.Good stuff lads.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35386.

dgrammatiko commented 2 years ago

You cannot edit SVG Files with Joomla's template manager The only formats supported are

@PhilETaylor in the template editor you should be able to edit the svg (using the codemirror editor, basically editing the text)

PhilETaylor commented 2 years ago

Yes but when Im talking about editing images with GD, they have to be one of those formats - not XML based SVG, which should be edited, not with GD Functions, but with text editor functions.

dgrammatiko commented 2 years ago

Yes but when Im talking about editing images with GD, they have to be one of those formats

Even Media manager can't handle all of the possible image formats (gif, ...) for some good reasons: https://github.com/joomla/joomla-cms/blob/932dea2c0d59fabff1865d9d4b667baa28b9d09a/administrator/components/com_media/resources/scripts/components/browser/items/image.vue#L205

PhilETaylor commented 2 years ago

LMAO - a Media manager that can only handle 3 file types LMAO

I dont have time to look into all the Media Manager issues this weekend. Its meant to be a holiday, but here I am at 21:28 drinking espresso and opening my IDE.

dgrammatiko commented 2 years ago

I dont have time to look into all the Media Manager issues

Quick recap: the media manager repo when abandoned had around 100 open issues I have a personal list of issues that are ranking from annoying bugs to serious sh**t

That doesn't mean that the media manager is bad, actually, it's the best implementation in the Joomla world (I've tested the others and they are 10 years behind). BUT needs hands to fix and implement whatever the MM team left half-baked...

PhilETaylor commented 2 years ago

Quick recap: the media manager repo when abandoned had around 100 open issues

Im no Javascript / Vue expert. I can only contribute minor fixes to javascript and fixes to the PHP side... and not 100 at a time :)

brianteeman commented 2 years ago

OK its not a bug then just not designed to do this.Good stuff lads.

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35386.

This should be closed now