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

Can you disable certain formats? I want only gif to be uploaded

AJā„¢

Chevereto Member
Hello, is there a way to disable other formats from being uploaded like jpg and png and only allow gif?
 
Hmmm yes. You will need to edit the content/system/js/chevereto.js file (therefore chevereto.min.js).

Change this:
Code:
fileTypeExts    : "*.jpg;*.jpeg;*.png;*.gif;*.bmp",

To this:
Code:
fileTypeExts    : "*.gif",

That will make the js only accept .gif files, now to have the real system (PHP) allowing only gif, go to includes/classes/class.upload.php and find this:
PHP:
    /**
    * valid_mime
    * Returns TRUE if the mimetype is suported
    *
    * @param    string
    * @return    boolean
    */
    private function valid_mime($mime)
    {
        return preg_match("@image/(gif|pjpeg|jpeg|png|x-png|bmp|x-ms-bmp)$@", $mime);
    }

Change that to:
PHP:
    /**
    * valid_mime
    * Returns TRUE if the mimetype is suported
    *
    * @param    string
    * @return    boolean
    */
    private function valid_mime($mime)
    {
        return preg_match("@image/(gif)$@", $mime);
    }

By the way, if you also want that the remote URL parse also only accept GIF images you have to edit includes/system/js/functions.js, change this:
Code:
/**
* Returns the url.matches (multiple)
*/
String.prototype.match_image_urls = function() {
    return this.match(/\b(?:ftp|https?):\/\/(?:[-\w])+([-\w\.])*\.[a-z]{2,6}(?:\/[^\/#\?]+)+\.(?:jpe?g|gif|png|bmp)\b/gim);
};

To this:
Code:
/**
* Returns the url.matches (multiple)
*/
String.prototype.match_image_urls = function() {
    return this.match(/\b(?:ftp|https?):\/\/(?:[-\w])+([-\w\.])*\.[a-z]{2,6}(?:\/[^\/#\?]+)+\.(?:gif)\b/gim);
};
 
You have a .htacces overwrite. It seems that other .htaccess rules are being read.
 
I just uploaded a clean version from the 2.5.6

Also I noticed a pretty funny gif was uploaded from a Chilean IP address, was that you? ;)
 
Yeah but you have that installation together with other script. That causes conflict.
 
The best that you can do is use a fresh install in a standalone domain or sub-domain. When you install more than 1 script in the same folder there could be problems regarding rewrite rules and things like that. Unless you want to do your very own tweaks to make both systems work 100% the most easy thing to do is to just setup a standalone installation.
 
Back
Top