• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space

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