• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.
  • Chevereto Support CLST

    Support response

    Support checklist

Embed link with image size

user_2b225

Chevereto Member
Is it possible to create the option so that it automatically indicates the size of the original image in the embed link?

Code:
<img src="smiley.gif" width="42" height="42" >

If yes, how can I do it?
 
This is a customization request, it would be easier if this topic could be moved into https://chevereto.com/community/forums/customizations.50/ and see if any one on forum can help adding such function to your chevereto since it isn't something that is made already by default.

Also keep in mind writing width and height into code will change the image size as well. So instead script creates 3 files 1. full size 2. medium size 3. thumbnail size. To view exact size you can right click on image and pick view picture and when it is loaded into new tab or same page so it is only the image. You can look on the tab at the top the actual image size. for example it would show as IMG_TEST (500x400). But if image name is longer than the tab then put mouse pointer on the tab and a popup information box appears with full name and whole size info + the website adress where image is loaded from.
 
The idea would be for it to automatically detect the height and width of the image, in order to write it in the embed link.

Has anyone done this?
 
I already found the solution.
In the embed.php file, where the embed codes are listed, just do this:

Code:
[img height=%HEIGHT% width=%WIDTH%]%URL%[/img]
 
I believe in the following file the corresponding variables can be found....
File: app\src\Legacy\Classes\Image.php

To specify the width in embed codes you could try this..... (at your own risk and not tested by me)
File: content\legacy\themes\Peafowl\snippets\embed.php
From line 38, for example, the "html codes" begin.
PHP:
    'html-codes' => [
        'label' => _s('HTML Codes'),
        'options' => [
            'html-embed' => [
                'label' => _s('HTML image'),
                'template' => '<img src="%URL%" alt="%FILENAME%" border="0">',
                'size' => 'full',
            ],
            'html-embed-full' => [
                'label' => _s('HTML full linked'),
                'template' => '<a href="%URL_VIEWER%"><img src="%URL%" alt="%FILENAME%" border="0"></a>',
                'size' => 'full',
            ],
            'html-embed-medium' => [
                'label' => _s('HTML medium linked'),
                'template' => '<a href="%URL_VIEWER%"><img src="%MEDIUM_URL%" alt="%MEDIUM_FILENAME%" border="0"></a>',
                'size' => 'medium',
            ],
            'html-embed-thumbnail' => [
                'label' => _s('HTML thumbnail linked'),
                'template' => '<a href="%URL_VIEWER%"><img src="%THUMB_URL%" alt="%THUMB_FILENAME%" border="0"></a>',
                'size' => 'thumb',
            ],
        ],
    ],

You could try changing it like this....
PHP:
    'html-codes' => [
        'label' => _s('HTML Codes'),
        'options' => [
            'html-embed' => [
                'label' => _s('HTML image'),
                'template' => '<img src="%URL%" width="'.$display_width.'" height="'.$display_height.'" alt="%FILENAME%" border="0">',
                'size' => 'full',
            ],
            'html-embed-full' => [
                'label' => _s('HTML full linked'),
                'template' => '<a href="%URL_VIEWER%"><img src="%URL%" width="'.$display_width.'" height="'.$display_height.'" alt="%FILENAME%" border="0"></a>',
                'size' => 'full',
            ],
            'html-embed-medium' => [
                'label' => _s('HTML medium linked'),
                'template' => '<a href="%URL_VIEWER%"><img src="%MEDIUM_URL%" alt="%MEDIUM_FILENAME%" border="0"></a>',
                'size' => 'medium',
            ],
            'html-embed-thumbnail' => [
                'label' => _s('HTML thumbnail linked'),
                'template' => '<a href="%URL_VIEWER%"><img src="%THUMB_URL%" alt="%THUMB_FILENAME%" border="0"></a>',
                'size' => 'thumb',
            ],
        ],
    ],
Here I used the variable "$display_width" and "$display_height"... Maybe it also works with "%width%" and "%height%".
For "Medium" and "Thumb" you can specify a fixed size which you have already entered in the admin area.

Note:
Unless you create a new file embed.php in the folder "overrides\snippets\" the default file will be overwritten with every update of Chevereto.
 
Last edited:
Back
Top