Forums  ›  Cheetah  ›  Bug Reports
 

Photo extensions for ads, groups, etc.

@Geek_Girl should already know this, but for anyone interested in reducing hard disk usage, there are a couple of things you can do to seriously save server space without Google throwing a spanner in the works by introducing a new photo format. 

When you, or a member uploads a file to the site, the photos module makes several copies, one for the main photo in an album and several for thumbnails used throughout the site. The photos which your members will view can be resized in the Photos module settings. I've set mine to 700 wide or 700 high and that seems to be fine on all platforms. There are other settings you can also change to reduce server space and make your site look different. Firstly, you can easily change the size of the thumbnails and that will significantly reduce the demand on your hard disk. In my opinion it also makes the site look better. Secondly, you can set the rate of compression which currently defaults to 85%. As 80% seems to be the industry standard, I set my sites to 80% and that also saves a lot more disk space.

The biggest saving of all is to delete the original photo from the server as soon as the photos have been uploaded and converted. Cheetah currently keeps a copy of the original photo and as far as I know it's not compressed. If a member posts 10 by 3 meg photos, all ten are saved on the server along with all the copies. "Why?" you may ask? Well, Cheetah has a rudimentary crop facility (Square Photos only, possibly to create avatars.) The original photo is used for the crop so as to give the best possible quality. Then there's an option when you're looking at a photo to View the Original. In most instances, the user will see little or no difference, because all browsers reduce photos to fit the screen anyway.

I've written a tutorial showing how to make all the above changes, but it's currently for Dolphin. I'll work on it over the weekend and convert it to work with Cheetah. Somewhere amongst all the earlier discussions about Cheetah, I prepared a suggestion for the photos module and I think I asked Deano to consider the "Delete Original" feature as being an option admins could select. If that's not the case, it's in a yet to be published paper requesting changes to the Crop facility. All in good time, but you can certainly make all the above changes and save heaps of server disk space immediately. One warning, it will only do it for new photos. You'll need to resize previously posted thumbnails and delete the original photos manually.

Yes, I don't know how widespread support is.  However, if the compression is good and you don't lose quality, then it helps to save drive space.  PNG is good but the file size isn't so good.  WebP may be one of those things that never really catches on.  The other thing is that the smaller the file, the less bandwidth it uses and the faster it loads to the page.  Here is a list of browser support 

this was posted oct 12 2020

Which web browsers natively support WebP?

Webmasters interested in improving site performance can easily create optimized WebP alternatives for their current images, and serve them on a targeted basis to browsers that support WebP.

  • WebP lossy support
    • Google Chrome (desktop) 17+
    • Google Chrome for Android version 25+
    • Microsoft Edge 18+
    • Firefox 65+
    • Opera 11.10+
    • Native web browser, Android 4.0+ (ICS)
  • WebP lossy, lossless & alpha support
    • Google Chrome (desktop) 23+
    • Google Chrome for Android version 25+
    • Microsoft Edge 18+
    • Firefox 65+
    • Opera 12.10+
    • Native web browser, Android 4.2+ (JB-MR1)
    • Pale Moon 26+
  • WebP Animation support
    • Google Chrome (desktop and Android) 32+
    • Microsoft Edge 18+
    • Firefox 65+
    • Opera 19+

Ok, the photo module is using the html5 uploader by default which supports these formats.

jpg
jpeg
png
webp
gif
svg

And apparently ignores the file extension setting in the photos module which seems only the regular uploader uses which i removed from this site and from the main cheetah distro. I did not even realize the html5 uploader ignored those file extensions.

Still does not explain the issue in the other modules.

Great, more stupid dolphin quirks i need to fix.


 

I just tried it on my Dolphin site and it worked there as well. Not so in the Groups module. No warnings, it just didn't appear.

 

My last post may not be too helpful because I probably didn't read the original question correctly. I was able to upload and view a .webp photo in a private album on this site and I suspect Cheetah converted it to a JPG.  That surprised me a bit because the discussions I could find on the Internet say you need a codec to convert the files. It also seems the files in their native format can't be seen by all browsers which is an interesting huge step backwards.  

What makes it even more interesting is this:  Although Cheetah's photo module converts the photos to JPG, do other third party modules? When I tried uploading the the photo to Modzzz's Answers module on this site, the photo never appeared. Thus I'm inclined to believe that Modzzz and possibly others, allow uploads and storage of certain photos in the file's native format. If you were to allow .webp files to be uploaded in this manner, people viewing a Cheetah site may not be able to see the photos because of the browser they use. 

If you ask me, it's just a ploy to force people to convert to Chrome, or use a third-party extension on their browser. Thus it may be best to ignore this format for the time being, as we do with TIFF and other obscure formats?

In all fairness, JPG does a pretty good job at 80% compression and it's only purists who need this kind of stuff. maybe it will be the format of the future, but maybe not.

@Geek_Girl, I realise people may wish to upload files in this format, but they also try uploading lots of other weird stuff and where does one draw the line?

Hmm, i will have to look into that as the upload should have been rejected. the webp file extension is not listed in the allowed files even in the photos module.

And based on info here, https://caniuse.com/webp the webp extension is supported by all current modern browsers except safari.

Also, php does have the needed functions to convert webp files.

My last post may not be too helpful because I probably didn't read the original question correctly. I was able to upload and view a .webp photo in a private album on this site and I suspect Cheetah converted it to a JPG.  That surprised me a bit because the discussions I could find on the Internet say you need a codec to convert the files. It also seems the files in their native format can't be seen by all browsers which is an interesting huge step backwards.  

What makes it even more interesting is this:  Although Cheetah's photo module converts the photos to JPG, do other third party modules? When I tried uploading the the photo to Modzzz's Answers module on this site, the photo never appeared. Thus I'm inclined to believe that Modzzz and possibly others, allow uploads and storage of certain photos in the file's native format. If you were to allow .webp files to be uploaded in this manner, people viewing a Cheetah site may not be able to see the photos because of the browser they use. 

If you ask me, it's just a ploy to force people to convert to Chrome, or use a third-party extension on their browser. Thus it may be best to ignore this format for the time being, as we do with TIFF and other obscure formats?

In all fairness, JPG does a pretty good job at 80% compression and it's only purists who need this kind of stuff. maybe it will be the format of the future, but maybe not.

@Geek_Girl, I realise people may wish to upload files in this format, but they also try uploading lots of other weird stuff and where does one draw the line?

I recall playing with this oneday. Maybe this will help:

/modules/photos/install.sql

('[db_prefix]_allowed_exts', 'jpg jpeg png gif', @iKatID, 'Allowed extensions', 'digit', '', '', 3, ''),

/modules/photos/chphotosuploader.php

                switch($aSize[2]) {

                    case IMAGETYPE_JPEG: $sExtension = '.jpg'; break;

                    case IMAGETYPE_GIF:  $sExtension = '.gif'; break;

                    case IMAGETYPE_PNG:  $sExtension = '.png'; break;

                    default:

                        @unlink($sTempFileName);

                        return false;

Considering the module does not have settings for this, and it seems similar modules that use a similar form layout for the adding of new items such as many of the modules from modzzz that started as a clone of one of the dolphin modules. Such as the answers and tutorials modules on this site also do not have their own image format settings.

So i am guessing that they must be hard coded somewhere and betting they are restricted to GIF, JPG and PNG.

I will look into it when i have some time. Considering many third party modules also use the global file handling classes from the inc folder, i would have to make that a global setting somewhere, other wise i could end up breaking 3'rd party modules.

But i have to locate where those extensions are checked first before i can do anything with it. So i will add it to my todo list.

This is not really a bug as such but thought this would be the best location to post.  Testing on the beta 1.1.0 I see that the ads module; and I am guessing photos in groups, etc, would not allow me to upload the webp extensions.  I thought the allowed extensions would be controlled by the photo module settings but adding webp as an allowable extension in photos settings still would not allow me to add a webp photo in the ads module.  Are the allowable photo extensions in the ads module hard coded?  If it is hard coded; then either each module with photo uploads should have an allowable extensions for photos, or, it could be a global setting, or just the allowable extensions as listed in the photo module.

I don't know the extend that sites are using webp images; it is a new compression from Google; royalty free, that is suppose to have lossless images at greater compression rates than the current lossless formats.

Forums  ›  Cheetah  ›  Bug Reports