Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logo with svg format #484

Closed
salahjaafar opened this issue Nov 29, 2023 · 22 comments · Fixed by #478
Closed

Logo with svg format #484

salahjaafar opened this issue Nov 29, 2023 · 22 comments · Fixed by #478
Labels

Comments

@salahjaafar
Copy link

In the new version, it is necessary to allow the logo to be added in svg format

@Joomlaplates
Copy link
Collaborator

You have to try out!!!
I think its even not possible to add a svg logo

@salahjaafar
Copy link
Author

salahjaafar commented Nov 30, 2023

I already use logo SVG Format with helix framework on this website: https://www.techno.rn.tn/fr/
Even with the template https://github.com/C-Lodder/lightning here is a screenshot:
Screenshot 2023-11-30 at 11-31-30 Templates Edit Style - Gestion des rapports radiologiques - Administration

@sonvnn
Copy link
Member

sonvnn commented Dec 1, 2023

I will add this feature in the next version. Please waiting for update.

Thank you for suggestion.

Best Regards,
Sonny

@salahjaafar
Copy link
Author

salahjaafar commented Dec 1, 2023

Thank you, Sonny, it will be another improvement option. Good luck!

sonvnn added a commit that referenced this issue Dec 1, 2023
@sonvnn
Copy link
Member

sonvnn commented Dec 1, 2023

@Joomlaplates @salahjaafar Astroid currently supports SVG Logos. I added it here 2ee58ff
Please help me download v3-branch and test it.

Thanks & Best Regards,
Sonny

@sonvnn
Copy link
Member

sonvnn commented Dec 1, 2023

Now you can configure logo max-width and max-height, too.
Screen Shot 2023-12-01 at 16 16 14

@Joomlaplates
Copy link
Collaborator

Hi Sonny,
I would set only the logo height and set the logo width always to > auto
Otherwise you get a problem with the ratio. But I never used SVG, so maybe its different here.
Regards Peter

@salahjaafar
Copy link
Author

@Joomlaplates @salahjaafar Astroid currently supports SVG Logos. I added it here 2ee58ff
Please help me download v3-branch and test it.

Thanks & Best Regards,
Sonny

Well done, I'll give it a try; you're putting in a great effort.

@salahjaafar
Copy link
Author

salahjaafar commented Dec 1, 2023

@sonvnn I tried the modified version and added a logo in SVG format, but an error occurred, blocking the site display:

ERROR 0 - Call to undefined method Joomla\Filesystem\File::getExt() in /opt/lampp/htdocs/joomla/libraries/astroid/framework/frontend/logo.php:118

I attempted to fix the error by replacing File::getExt with JFile::getExt, and it worked correctly.

Screenshot

@Joomlaplates
Copy link
Collaborator

Hi Sonny, I got the same error
image001

@sonvnn
Copy link
Member

sonvnn commented Dec 2, 2023

@Joomlaplates @salahjaafar Opp! I forgot this function works on Joomla 5 only. I replaced it with Joomla\CMS\Filesystem\File::getExt() It's alternative function for J4.4. Please help me check it. 83b171e

Best Regards,
Sonny

@salahjaafar
Copy link
Author

salahjaafar commented Dec 2, 2023

@sonvnn Replace File::getExt on line 118 in the file logo.php with JFile::getExt. This will work with Joomla 4.4.0. You can set up conditions based on the Joomla version using the constant JVERSION.

@sonvnn
Copy link
Member

sonvnn commented Dec 2, 2023

@salahjaafar JFile is deprecated in Joomla 5. If you turn off Backward Compatible Plugin in Joomla 5. All functions (JFactory, JFile, JFilter, etc) will raise error.

Astroid now work stabled with Joomla 5 even admin turn B/C plugin off.

Joomla\CMS\Filesystem\File will work with both of J4 and J5. It will deprecated in J6 only. So don't worry until J6 released.

Thanks & Best Regards,
Sonny

@salahjaafar
Copy link
Author

@sonvnn you can configure conditions based on the Joomla version using the JVERSION constant so that the framework works with all versions of Joomla

@Joomlaplates
Copy link
Collaborator

@sonvnn you can configure conditions based on the Joomla version using the JVERSION constant so that the framework works with all versions of Joomla

Yes I just wanted to ask if there is no option like:
if else j4 or j5

@salahjaafar
Copy link
Author

salahjaafar commented Dec 2, 2023

Description:

@sonvnn @Joomlaplates This code snippet is designed to retrieve the major version of the Joomla CMS using the Joomla\CMS\Version\Version class. It then checks the Joomla version and prints a message based on the major version.

Code Explanation:

use Joomla\CMS\Version;

// Get the Joomla CMS version
$joomlaVersion = Version::MAJOR_VERSION;

if (strpos($joomlaVersion, '5') !== false) {
    echo 'Joomla 5';
} elseif (strpos($joomlaVersion, '4') !== false) {
    echo 'Joomla 4';
} else {
    echo 'Unknown Joomla version';
}
  • The use Joomla\CMS\Version; statement imports the Version class, allowing us to access Joomla's version information.

  • $joomlaVersion = Version::MAJOR_VERSION; retrieves the major version of the Joomla CMS.

  • The code then checks if the Joomla version contains '5' or '4' and prints the corresponding message. If neither condition is met, it prints 'Unknown Joomla version.'

Usage:

You can incorporate this code into your Joomla extension or wherever you need to determine the Joomla CMS version dynamically.


@sonvnn
Copy link
Member

sonvnn commented Dec 4, 2023

@salahjaafar @Joomlaplates It's not necessary. We can not use both of them in one file like this

use Joomla\CMS\Filesystem\File;
use Joomla\Filesystem\File;

It will raise error. We can use Joomla\CMS\Filesystem\File right now. It compatible with J4 and J5. And wait Joomla 4.4 update. I reported issue to Joomla in joomla/joomla-cms#42460

@salahjaafar
Copy link
Author

@sonvnn Well done and to be continued...

@dgrammatiko
Copy link

We can not use both of them in one file like this

You CAN!

use Joomla\CMS\Filesystem\File as CMSFile;
use Joomla\Filesystem\File;

@sonvnn
Copy link
Member

sonvnn commented Dec 5, 2023

@dgrammatiko @salahjaafar @Joomlaplates Yes I know it. Actually, I don't want to mess up my code with this stupid option. I think instead of arguing which function should be used. Why don't we ask Joomla team to fix it. Please follow me on joomla/joomla-cms#42460

@salahjaafar
Copy link
Author

@sonvnn Alright, you're right, it's an optional feature. However, maybe if you add a textarea field to easily insert the SVG code, as seen in the template at https://github.com/C-Lodder/lightning, that could be a good idea.

@salahjaafar
Copy link
Author

Hi everyone,

@sonvnn @dgrammatiko @Joomlaplates I wanted to share an interesting find regarding a version comparison function in Joomla. While digging into the source code of a plugin I'm currently using, I came across a noteworthy use of the version_compare(JVERSION) function.

This function is employed to compare the Joomla version with a specified value, and in this particular case, the comparison is made against version 4. The idea is to ensure that the plugin remains compatible with the latest Joomla versions.

If this piques your interest, the plugin in question is the "Simple Image Gallery" developed by JoomlaWorks. You can learn more about its functionality by following this link: Simple Image Gallery.

I find the use of version_compare in the context of Joomla extensions to be an intriguing approach for ensuring smooth compatibility with different CMS versions. If you have other examples or similar experiences, feel free to share them.

Happy exploring, everyone!

@sonvnn sonvnn linked a pull request Dec 12, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants