9

The 'jpeg_quality' filter hook functions accept two arguments: $jpeg_quality and $function which is the function from within the filter hook is fired and can be either image_resize or wp_crop_image. So there is no way to selectively set the quality of .jpeg images according to image size from this filter hook function. However, you still can hook to a later ...


7

Let’s start with the output we got before the fix: What happened here? My guess: a collision between the plugin W3 Total Cache and your web server LiteSpeed. I found a thread in a Drupal forum about a very similar (or the same) issue. LiteSpeed seems not to send the appropriate HTTP headers for the compressed cache files W3TC stores. In its changelog for ...


6

Some suggestions: If you want to try out the Image Editor API you can try to replace imagejpeg( $resource, $image, 35 ); with: $editor = wp_get_image_editor( $image ); if ( ! is_wp_error( $editor ) ) { $editor->set_quality( 35 ); $editor->save( $image ); } unset( $editor ); Also try to test e.g. these parts: $resource = ...


4

This happened to me because I had two plugins trying to GZip compress the output. Disabling the second plugin fixed the problem.


3

You can try to use the attachment_submitbox_misc_actions filter to add more info to the box. Here is an example for the filesize part: add_action( 'attachment_submitbox_misc_actions', 'custom_fileinfo_wpse_98608' ); function custom_fileinfo_wpse_98608(){ global $post; $meta = wp_get_attachment_metadata( $post->ID ); $upload_dir = ...


3

You'll need to log onto your FTP server and goto the wp-content folder -> plugins -> and delete the GZIP plugin you have installed. If you are not sure about FTP, you can probably try and go through your web server control panel, they usually have some sort of file browsing option. You might also need to check the .htaccess file also, but just try removing ...


3

I find that W3 Total Cache works well for me in doing minifying and gzipping. (I'm not sure about the others.) More generally, if there's a plugin that does something, I use the plugin. It's very rare to see a do-it-all theme do something better than a specialized, single-function plugin, particularly when that plugin is of the caliber of W3 Total Cache.


2

Without going into the Plugin code and then figuring out the PHP method used to create the zip archive you're better off just opening the file and checking the contents as @fdsa suggests. The stored 0% would indicate there was nothing in the directory to add to the archive. The deflated xx% indicates the percentage the file was compressed by adding it ...


2

To answer your question, yes, it is that easy to enable compression. However, that's only a small step when configuring a site for performance. You should not attempt to handle compression from your plugin, unless the entire purpose of the plugin is load time optimization. Leave that to dedicated plugins, such as the WP Super-Cache or W3 Total Cache.


2

Always specify the encoding used for an HTML or XML page. If you don't, characters in your content may be incorrectly interpreted. Look inside your header file to specify English and UTF-8 settings. Here's whats in my header: <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"> <head profile="http://gmpg.org/xfn/11"> <meta http-...


2

i'm looking for a more discrete and automatic approach. And that is altering the wp_create_thumbnail i think. And that is where you'd be wrong. Here is the entire code for wp_create_thumbnail() from core: function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) { if ( !empty( $deprecated ) ) _deprecated_argument( __FUNCTION__, '1.2' )...


2

The question is old. However, there are a lot of people who are facing the same issue in 2018. So, I am giving the the most effective answer. There are different ways to optimize images: Use the right format: Make sure to upload iamges to your WordPress website in JPEG format, rather than PNG. The latter one eats up a lot of space. Resize Images: You can ...


2

First, don't let Google Insights drive you to chase an ROI that might not be there. Maybe for 1M of image data improvement, it is worth looking into - but after awhile that tool will have you minifying 1K css files to save 100 bytes. Second, regarding images - don't just blindly reduce ('compress'...really a misnomer) jpeg images. jpeg is a lossy format ...


2

Short and anticlimactic answer: the big fancy corporate firewall protecting the server was set to HTTP "application" mode. We switched it over to simply allowing all traffic on port "80" and the issue was solved. Rarst♦ was right!


2

This 2 functions will work with custom mime uploaded files (like PSD, EPS) when meta not avaible. It also returns more then just a lot of bytes, means, 2 decimal logic unit. The 99 places the info last in the meta box. // Helper function ua_formatBytes($bytes, $precision = 2) { $units = array('B', 'kB', 'mB', 'GB', 'TB'); $bytes = max($...


2

It's set in schema.php, the WordPress Administration Scheme API. You can also find it in the Codex. As you can see from a search through core, there's (as far as my search went) exactly no use case for it, aside from defining it as 0 when adding that option to the DB. If you want to know if it's working on your site, just enter your URL here.


2

If you have a web server that support gzip compression, it might not make a lot of a difference. Also, the size probably is still rather small by nowadays standards, compared to web fonts, videos, and likely even the images on an average site. Static files will also temporarily be cached client side. If you don't have a traffic problem, why optimize? What ...


2

Minifying the CSS and JavaScript files is totally optional. The most important result is that your files are going to take less space, and be served more quickly. This will result in saving bandwidth, if you have a limited plan. These files will be executed in the client, so the more optimized they are, the better user experience they create. The core ...


1

There is little 'bug' in PHPWee. It should use <?php instead of <?: <? namespace PHPWee; require_once("src/CssMin/CssMin.php"); require_once("src/HtmlMin/HtmlMin.php"); require_once("src/JsMin/JsMin.php"); // Open-source (BSD) PHP inline minifier functions for HTML, XHTML, HTML5, CSS 1-3 and Javascript. // BSD Licensed - https://github.com/...


1

That is a huge difference! I think this is your issue... Any time an image is uploaded, if that image was saved in the Adobe RGB color space, then the image does not get loaded correctly for resizing. Thumbnails are saved in the default color space, which is sRGB. By failing to perform the color conversion, and then failing to specify the non-default ...


1

(this should be a comment, but my reputation is too low) Setting jpeg_quality will not disable compression because it does not disable processing. JPEGs will be always compressed, and they are almost never lossless, not even at 100 - it does not stand for "100% original quality". What happens here, is that WordPress's default image processing does not ...


1

Make sure you convert your images to sRGB before uploading them to WordPress. Image compression should not dramatically affect the colors and tones of the picture. When you witness a significant shift in color, hue, saturation or contrast, it might be a color space issue (as the asker pointed out herself).


1

I used your exact set of .htaccess directives to achive json gzip'ing. Took my files from 23k to 4k. So I would assume its one of the two following things: Your.htaccess is not allowed to use these directives so it ignores them. Thus you either need to do one of the following: a) edit the httpd.conf or /etc/apache/sites-available/site.conf or httpd-...


1

For compressing the uploaded image I wrote a simple code snippet that immediately overwrites a newly uploaded file with an image whose quality can be specified: function wt_handle_upload_callback( $data ) { $image_quality = 30; // Change this according to your needs $file_path = $data['file']; $image = false; switch ( $data['type'] ) { ...


1

A nice explanation is at WPMUdev: http://premium.wpmudev.org/blog/how-to-change-jpeg-compression-in-wordpress/ According to their tutorial, you'd need to add the following to your functions.php add_filter( 'jpeg_quality', create_function( '', 'return 100;' ) ); They also suggest regenerating your thumbnails once the change is made so previously uploaded ...


1

One solution I found was to include the original image in the $sizes array. Like this, after all the conversions to others sizes the uploaded image will also be converted to its same size and some other given quality. Please note that by doing this you'll lose the original image, and if you add any other size after the image is first uploaded, then the ...


1

My advice to you is not to worry about adding in the copious amount of .htaccess rules for forcing browser caching and setting correct expire time values for assets. If you download the W3 Total Cache plugin it handles adding all of the above into your .htaccess file for you. If you would prefer not to install the caching plugin, I've taken the liberty of ...


1

This option was used years ago to activate a handler for output buffering. It was off by default, and it didn’t work very good when enabled. Will be removed completely eventually. See Ticket #12996.


1

Using a filter for jpg_quality will hellp you to set your quality for uplaoded images. add_filter('jpeg_quality', create_function('$n', 'return 70;')); In most good implementations of Image Optimization you can find a various usae of ImageOptimization tools such as optimng/jpegtran etc, there a lot of plugins that help you to do that.


1

If the theme's settings works correctly, I'd recommend it, so that you can reduce the number of plugins you have installed. :) But, as you have multisite, you are probably not going to use the same theme everywhere. In that case, you may just rely on W3 Total Cache plugin that does the job well on all the sites. As @mrwweb already mentioned, there are ...


Only top voted, non community-wiki answers of a minimum length are eligible