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

[Unofficial]Image + Link

Avast

👽 Chevereto Freak
This is not a real mod, just a small modification.

If you don't know what i mean:
chevereto shows us codes like:
Code:
[url=http://demo.chevereto.com/images/IDCzs.jpg][img]http://demo.chevereto.com/images/thumbs/IDCzs.jpg[/img][/url]

but we want people who click on our pictures/thumbs to land on our viewer, then we have a code like this:

Code:
for thumbs+ link to viewer
[url=http://demo.chevereto.com/?v=IDCzs.jpg][img]http://demo.chevereto.com/images/thumbs/IDCzs.jpg[/img][/url]
or
for image+ link to viewer
[url=http://demo.chevereto.com/?v=IDCzs.jpg][img]http://demo.chevereto.com/images/images/IDCzs.jpg[/img][/url]

If you want to have an image + Link code in your viewer instead of an thumbnail + link bb-code, you have to go to your chevereto/includes/template.function.php

goto line 373
Code:
/**
 * get_thumb_bbcode
 * Returns the thumb + img link as bbcode
 */
function get_thumb_bbcode() {
    return htmlentities('[url='.get_img_url().'][img]'.get_thumb_url().'[/img][/url]');
}
function show_thumb_bbcode() {
    echo get_thumb_bbcode();
}

replace with:
image + link to viewer version
Code:
/**
 * get_thumb_bbcode
 * Returns the thumb + img link as bbcode
 */
function get_thumb_bbcode() {
    return htmlentities('[url='.get_img_viewer().'][img]'.get_img_url().'[/img][/url]');
}
function show_thumb_bbcode() {
    echo get_thumb_bbcode();
}



thumb + link to viewer:
Code:
/**
 * get_thumb_bbcode
 * Returns the thumb + img link as bbcode
 */
function get_thumb_bbcode() {
    return htmlentities('[url='.get_img_viewer().'][img]'.get_thumb_url().'[/img][/url]');
}
function show_thumb_bbcode() {
    echo get_thumb_bbcode();
}



UPDATE

If you want the image + link to viewer code seperated, follow my instructions:

After this you will have codes like me:


first, open view.php (chevereto/content/themes/Paefowl/view.php


after
Code:
<div class="input-item"><label for="thumb-url"><?php show_lang_txt('txt_thumb_url'); ?>:</label> <input type="text" id="thumb-url" value="<?php show_thumb_url(); ?>" /></div>

add:
Code:
 <div class="input-item"><label for="bb-code-link"><?php show_lang_txt('txt_img_plus_link_bbcode'); ?>:</label> <input type="text" id="bb-code-link" value="<?php show_img_link(); ?>" /></div>

open

after:

Code:
/**
 * get_thumb_bbcode
 * Returns the thumb + img link as bbcode
 */
function get_thumb_bbcode() {
    return htmlentities('[url='.get_img_url().'][img]'.get_thumb_url().'[/img][/url]');
}
function show_thumb_bbcode() {
    echo get_thumb_bbcode();
}

add:

Code:
/**
 * get_image_link
 * Returns the image + img link to bb-code as bbcode
 */
function get_img_link() {
    return htmlentities('[url='.get_img_viewer().'][img]'.get_img_url().'[/img][/url]');
}
function show_img_link() {
    echo get_img_link();
}

Now the link will be displayed, but without discription.
To fix this, open your language file (chevereto/content/languages/yourlanguage

Code:
$lang['txt_img_plus_link_bbcode'] = 'BB Code (Image to Viewer)';

So, now we want that the code is changing, if we upload more than one file.
open:/content/system/js/peafowl.php

search for :
(line 346)
Code:
// Changes
var ChangedIDs = ["viewer-link", "direct-link", "html-image", "html-code", "bb-code", "bb-code-thumb", "thumb-url"];

add:
Code:
"bb-code-link"

it have to look like this:
Code:
// Changes
        var ChangedIDs = ["viewer-link", "direct-link", "html-image", "html-code", "bb-code", "bb-code-thumb", "thumb-url","bb-code-link"];

now it works, without any bugs :)
Finish :)

thanks to Rodolfo
 
There is something wrong.....

if you follow my instructions in "UPDATE" , chevereto displays the code... but if you upload more than one image, chevereto displays the image + link to viewer code of the first image for all images!

Don't know how to fix it, but i'll think about it.
 
That is because when the image changes a javascript function is triggered. You can check this line in /content/system/js/peafowl.php:

Code:
// Changes
var ChangedIDs = ["viewer-link", "direct-link", "html-image", "html-code", "bb-code", "bb-code-thumb", "thumb-url"];

If you notice, the ChangedIDs are the input ID of each displayed code. If you add a new code you need to use a new unique ID and add it on this array. Then you will get the onchange.

Hope it helps.
 
Back
Top