• 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.

Alternative Embed codes order for image page

mkerala

👽 Chevereto Freak
The default Embed code has direct link to the image placed first followed by direct link HTML, BBC and Markup codes. This tend to favor hotlinking without linking back to the image host.

I have redesigned it favoring linking back to the site as follows. Screenshot attached

Common Links
1. Image link
2. HTML (linked)
3. BBCode (linked)
4. Markdown (linked)

Direct links
1. Image URL
2. Thumbnail URL
3. Medium URL

Direct Full Image

1. HTML
2. BBCode
3. Markdown

Medium image (linked)
1. HTML
2. BBCode
3. Markdown

Thumbnail image (linked)
1. HTML
2. BBCode
3. Markdown


From line 250 of route.image.php change as below and upload it to /app/routes/overrides/

PHP:
// Embed codes
        $embed = [];
       
        $image_full = [
            'html'        => '<img src="'.$image['url'].'" alt="'.$image['filename'].'" border="0" />',
            'markdown'    => '!['.$image['filename'].']('.$image['url'].')'
        ];
        $image_full['bbcode'] = G\html_to_bbcode($image_full['html']);
       
           
        $embed_full_linked['html'] = '<a href="'.$image['url_viewer'].'">'.$image_full['html'].'</a>';
        $embed_full_linked['bbcode'] = G\html_to_bbcode($embed_full_linked['html']);
        $embed_full_linked['markdown'] = '[!['.$image['filename'].']('.$image['url'].')]('.$image['url_viewer'].')';
       
        $embed['full-linked'] = [
            'label' => _s('Common Links'),
            'entries' => [
                [
                    'label' => _s('Image link'),
                    'value' => $image['url_viewer']
                ],
                [
                    'label' => 'HTML',
                    'value' => htmlentities($embed_full_linked['html'])
                ],
                [
                    'label' => 'BBCode',
                    'value' => $embed_full_linked['bbcode']
                ],
                [
                    'label' => 'Markdown',
                    'value' => $embed_full_linked['markdown']
                ],
            ]
        ];
       
        $embed['direct-links'] = [
            'label' => _s('Direct links'),
            'entries' => [
                [
                    'label' => _s('Image URL'),
                    'value' => $image['url']
                ],
               
                [
                    'label' => _s('Thumbnail URL'),
                    'value' => $image['thumb']['url']
                ],
            ]
        ];
       
        $embed['full-image'] = [
            'label' => _s('Direct Full image'),
            'entries' => [
                [
                    'label' => 'HTML',
                    'value' => htmlentities($image_full['html'])
                ],
                [
                    'label' => 'BBCode',
                    'value' => $image_full['bbcode']
                ],
                [
                    'label' => 'Markdown',
                    'value' => $image_full['markdown']
                ],
            ]
        ];
       
        if($image['medium']) {
            $embed['direct-links']['entries'][] = [
                'label' => _s('Medium URL'),
                'value' => $image['medium']['url']
            ];
        }
       
        if($image['medium']) {
            $embed_medium_linked = array(
                "html" => '<a href="'.$image['url_viewer'].'"><img src="'.$image['medium']['url'].'" alt="'.$image['filename'].'" border="0" /></a>'
            );
            $embed_medium_linked['bbcode'] = G\html_to_bbcode($embed_medium_linked['html']);
            $embed_medium_linked['markdown'] = '[!['.$image['medium']['filename'].']('.$image['medium']['url'].')]('.$image['url_viewer'].')';
            $embed['medium-linked'] = [
                'label' => _s('Medium image (linked)'),
                'entries' => [
                    [
                        'label' => 'HTML',
                        'value' => htmlentities($embed_medium_linked['html'])
                    ],
                    [
                        'label' => 'BBCode',
                        'value' => $embed_medium_linked['bbcode']
                    ],
                    [
                        'label' => 'Markdown',
                        'value' => $embed_medium_linked['markdown']
                    ],
                ]
            ];
        }
       
        $embed_thumb_linked = [
            'html' => '<a href="'.$image['url_viewer'].'"><img src="'.$image['thumb']['url'].'" alt="'.$image['filename'].'" border="0" /></a>'
        ];
        $embed_thumb_linked['bbcode'] = G\html_to_bbcode($embed_thumb_linked['html']);
        $embed_thumb_linked['markdown'] = '[!['.$image['thumb']['filename'].']('.$image['thumb']['url'].')]('.$image['url_viewer'].')';
       
        $embed['thumb-linked'] = [
            'label' => _s('Thumbnail image (linked)'),
            'entries' => [
                [
                    'label' => 'HTML',
                    'value' => htmlentities($embed_thumb_linked['html'])
                ],
                [
                    'label' => 'BBCode',
                    'value' => $embed_thumb_linked['bbcode']
                ],
                [
                    'label' => 'Markdown',
                    'value' => $embed_thumb_linked['markdown']
                ],
            ]
        ];

To view this in action check https://gifyu.com/image/0W2
 

Attachments

  • Capture.JPG
    Capture.JPG
    80.2 KB · Views: 118
Problem is everyone has different priorities on how they use the script.

Ideally being able to choose what you see and setting the order would be a great addition to the backend. Something similar to how you can order "Pages" etc would be good :)
 
Problem is everyone has different priorities on how they use the script.

Ideally being able to choose what you see and setting the order would be a great addition to the backend. Something similar to how you can order "Pages" etc would be good :)
This would be the best way moving forward. Also saves me time editing the routes file after every update. Better we raise this is suggestions section to more visibility.
 
Indeed. I use overrides to help me manage this. My users prefer direct link first. I love how easy it is to edit the order.
 
Back
Top