Add Additional File Info (jpeg compression & file size) settings to Edit Images Screen

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 = wp_upload_dir(); $filepath = $upload_dir[‘basedir’].”https://wordpress.stackexchange.com/”.$meta[‘file’]; $filesize = filesize($filepath); ?> <div class=”misc-pub-section”> <?php _e( ‘File Size:’ ); ?> <strong><?php … Read more

Compress WordPress core files ( JS and CSS )

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 … Read more

Autogenerated Thumbnail compression depending on size

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’ ); $thumbpath = image_resize( … Read more

strange characters in wordpress website displayed for visitors [closed]

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 … Read more

Setting JPEG compression for custom image sizes doesn’t work in specific cases

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 = … Read more

Set JPEG compression for specific custom image sizes

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 … Read more

Curl Error 56 “Failure when receiving data from the peer” while sending .tar.gz File

cURl error 56 can have different reason like: Passing data to be uploaded in URL itself instead of POST request Probably Proxy blocking the request to the server. In some cases, server do not support particular request, like some servers support PUT/POST any one of them. When I received this error last time, it was … Read more

JavaScript implementation of Gzip

Edit There appears to be a better LZW solution that handles Unicode strings correctly at http://pieroxy.net/blog/pages/lz-string/index.html (Thanks to pieroxy in the comments). I don’t know of any gzip implementations, but the jsolait library (the site seems to have gone away) has functions for LZW compression/decompression. The code is covered under the LGPL.