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

Watermark option on upload

Kewa

Chevereto Member
Hello. And at first, I'd like to thank all the authors for a greate app. )
I would like to let my users decide to use or not to use the watermark. Is there any possibility to place such checkbox for example in upload options area?
 
Nope, unless you built up something and hook it to the upload request. Not very easy.
 
Perhaps I've typed it wrong, sorry for my poor english, but I mean something like this.

Not a script for uploading custom watermarks, but just a switch, that enables or disables the use of my site's watermark.
I try to implement it myself, but my js skill is not enough. )
Anyway, thanks for reply.
 
Ok, was able to make it myself. Here's what I've changed:
in content/themes/Peafowl/index.php add
PHP:
<div><input type="checkbox" id="pref-watermark" <?php if(isset($_COOKIE['doWMark'])) echo 'checked="checked"'; ?> /> <label for="pref-watermark"><?php show_lang_txt('txt_watermark_enable'); ?></label></div>
after
PHP:
<div><input type="checkbox" id="pref-shorturl" <?php if(isset($_COOKIE['doShort'])) echo 'checked="checked"'; ?> /> <label for="pref-shorturl"><?php show_lang_txt('txt_create_short_url'); ?> <?php show_tinyurl_service(); ?></label></div>
in includes/functions.php add
PHP:
function is_user_preference_watermark() {
        return (isset($_COOKIE['doWMark'])) ? true : false;
}
after
PHP:
function is_user_preference_short_url() {
        return (isset($_COOKIE['doShort'])) ? true : false;
}
in includes/classes/class.upload.php change line
PHP:
if(!is_animated_image($this->working) && conditional_config('watermark_enable') and chevereto_config('watermark_opacity')>0)
to
PHP:
if(!is_animated_image($this->working) && conditional_config('watermark_enable') and chevereto_config('watermark_opacity')>0 and is_user_preference_watermark())
in content/themes/Peafowl/theme.js add
Code:
preferences_watermark          : "#pref-watermark",
after
Code:
preferences_shorturl            : "#pref-shorturl",
and
Code:
 $(selectors.preferences_watermark).change(function(){
                $(this).ajax_watermark_enable();
        });
after
Code:
$(selectors.preferences_shorturl).change(function(){
                $(this).ajax_short_url();
        });
in content/system/js/chevereto.js add
Code:
preferences_watermark          : "#pref-watermark",
after
Code:
preferences_shorturl            : "#pref-shorturl",
and
Code:
jQuery.fn.ajax_watermark_enable = function() {
        $.ajax({url: base_url_js+"pref.php?doWMark="+($(get_safe_selector("preferences_watermark")).is(':checked')?1:0)});
};
after
Code:
jQuery.fn.ajax_short_url = function() {
        shorturl_checkbox_selector = this;
        $(get_safe_selector("uploadify")).uploadify('settings', 'formData',{sID: session_id, doShort: shorturl_checkbox_selector.is(':checked')});
        $.ajax({url: base_url_js+"pref.php?doShort="+(shorturl_checkbox_selector.is(':checked')?1:0)});
};
in content/system/js/pref.php add
PHP:
$doWMark = $_GET['doWMark'];
after
PHP:
$doShort = $_GET['doShort'];
and
PHP:
if ($doWMark=='0') setcookie('doWMark', '', time() - 3600, __CHV_RELATIVE_ROOT__, $_SERVER['SERVER_NAME']);
if ($doWMark=='1') setcookie('doWMark', 1, time()+60*60*24*30, __CHV_RELATIVE_ROOT__, $_SERVER['SERVER_NAME']);
after
PHP:
if ($doShort=='1') setcookie('doShort', 1, time()+60*60*24*30, __CHV_RELATIVE_ROOT__, $_SERVER['SERVER_NAME']);
Just need to delete content/system/js/chevereto.min.js and content/themes/Peafowl/theme.min.js after modification.
In fact I just copied over the short url code with a little change. Maybe it can be useful to someone else.
 
Told you it wasn't easy (like changing one line). I'm glad that you found the way to make it and thanks for sharing. Really appreciated.

Cheers.
 
Hello, I'd need a little help.

I change this
Code:
 <div><input type="checkbox" id="pref-watermark" <?php if(isset($_COOKIE['doWMark'])) echo 'checked="checked"'; ?> /> <label for="pref-watermark"><?php show_lang_txt('txt_watermark_enable'); ?></label></div>

to this

Code:
 <div><input type="checkbox" id="pref-watermark" <?php if(isset($_COOKIE['doWMark'])) echo 'checked="checked"'; ? checked> /> <label for="pref-watermark"><?php show_lang_txt('txt_watermark_enable'); ?></label></div>

and when somebody come to my website on upload options there is checked checkbox but when i try to upload image WM dosen't appear on image.... and if i uncheck and then check checkbox then WM shows.... so i want to WM by default comes on image, but if user want he can uncheck chechbox so WM don't come on image.... how to do that?
 
Ok, was able to make it myself. Here's what I've changed:
in content/themes/Peafowl/index.php add
PHP:
<div><input type="checkbox" id="pref-watermark" <?php if(isset($_COOKIE['doWMark'])) echo 'checked="checked"'; ?> /> <label for="pref-watermark"><?php show_lang_txt('txt_watermark_enable'); ?></label></div>
after
PHP:
<div><input type="checkbox" id="pref-shorturl" <?php if(isset($_COOKIE['doShort'])) echo 'checked="checked"'; ?> /> <label for="pref-shorturl"><?php show_lang_txt('txt_create_short_url'); ?> <?php show_tinyurl_service(); ?></label></div>
in includes/functions.php add
PHP:
function is_user_preference_watermark() {
        return (isset($_COOKIE['doWMark'])) ? true : false;
}
after
PHP:
function is_user_preference_short_url() {
        return (isset($_COOKIE['doShort'])) ? true : false;
}
in includes/classes/class.upload.php change line
PHP:
if(!is_animated_image($this->working) && conditional_config('watermark_enable') and chevereto_config('watermark_opacity')>0)
to
PHP:
if(!is_animated_image($this->working) && conditional_config('watermark_enable') and chevereto_config('watermark_opacity')>0 and is_user_preference_watermark())
in content/themes/Peafowl/theme.js add
Code:
preferences_watermark          : "#pref-watermark",
after
Code:
preferences_shorturl            : "#pref-shorturl",
and
Code:
 $(selectors.preferences_watermark).change(function(){
                $(this).ajax_watermark_enable();
        });
after
Code:
$(selectors.preferences_shorturl).change(function(){
                $(this).ajax_short_url();
        });
in content/system/js/chevereto.js add
Code:
preferences_watermark          : "#pref-watermark",
after
Code:
preferences_shorturl            : "#pref-shorturl",
and
Code:
jQuery.fn.ajax_watermark_enable = function() {
        $.ajax({url: base_url_js+"pref.php?doWMark="+($(get_safe_selector("preferences_watermark")).is(':checked')?1:0)});
};
after
Code:
jQuery.fn.ajax_short_url = function() {
        shorturl_checkbox_selector = this;
        $(get_safe_selector("uploadify")).uploadify('settings', 'formData',{sID: session_id, doShort: shorturl_checkbox_selector.is(':checked')});
        $.ajax({url: base_url_js+"pref.php?doShort="+(shorturl_checkbox_selector.is(':checked')?1:0)});
};
in content/system/js/pref.php add
PHP:
$doWMark = $_GET['doWMark'];
after
PHP:
$doShort = $_GET['doShort'];
and
PHP:
if ($doWMark=='0') setcookie('doWMark', '', time() - 3600, __CHV_RELATIVE_ROOT__, $_SERVER['SERVER_NAME']);
if ($doWMark=='1') setcookie('doWMark', 1, time()+60*60*24*30, __CHV_RELATIVE_ROOT__, $_SERVER['SERVER_NAME']);
after
PHP:
if ($doShort=='1') setcookie('doShort', 1, time()+60*60*24*30, __CHV_RELATIVE_ROOT__, $_SERVER['SERVER_NAME']);
Just need to delete content/system/js/chevereto.min.js and content/themes/Peafowl/theme.min.js after modification.
In fact I just copied over the short url code with a little change. Maybe it can be useful to someone else.


hello there, im really new to this api, i wanted to add custom text as watermark, i done all the things you've done, but i cant seem to find where i specify that custom text, and how. Now i upload file it just uploads it without any watermark, what i'm i missing here? does this have to do with if(isset($_COOKIE) condition in index page?
 
Back
Top