Plugin Directory

Changeset 829676

Timestamp:
12/29/2013 07:10:24 AM (11 years ago)
Author:
mbijon
Message:

Merge v2.1.1 from github

Location:
wp-resized-image-quality/trunk
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • wp-resized-image-quality/trunk/readme.txt

    r826421 r829676  
    44Requires at least: 3.1
    55Tested up to: 3.8.0
    6 Stable tag: 2.1
     6Stable tag: 2.1
    77
    88Get better uploaded quality or save bandwidth: Change the JPEG compression-level of uploaded images and thumbnails.
     
    3939
    4040
    41 = What about PNG and GIF images? =
     41= What about PNG and GIF images? =
    4242
    4343WordPress doesn't currently support PNG compression internally (none at all). There are other image-handling plugins that compress PNGs and GIFs, but they either require server-side tools or a 3rd-party service. For a Plugin using server-side tools, try 'EWWW Image Optimizer'. For a Plugin using a 3rd-party service, try 'WP Smush.it'.
     
    5454
    5555
    56 = Does this plugin compress PNG files? =
    57 
    58 No, it doesn't. All the PNG compression tools I've found aren't standard on most servers. You would need root access and a more-complicated plugin to get PNG compression working.
    59 
    60 
    6156
    6257== Screenshots ==
     
    6661
    6762== Changelog ==
     63
     64
     65
    6866
    6967= 2.1 =
  • wp-resized-image-quality/trunk/wp-resized-image-quality.php

    r826421 r829676  
    44Plugin URI: http://www.etchsoftware.com/#how-do-i-get-in-touch
    55Description: Change the compression-level of uploaded images and thumbnails. Get better image quality or save bandwidth.
    6 Version: 2.1
     6Version: 2.1
    77Author: Mike Bijon, Etch Software
    8 Author URI: http://www.mbijon.com/about
     8Author URI: http://www.mbijon.com
    99License: GPLv2
    1010
     
    5050     * Version # of WP-Resized-Image-Quality
    5151     */
    52     const RIQ_PLUGIN_VERSION = '2.0';
     52    const RIQ_PLUGIN_VERSION = '2.';
    5353   
    5454    /**
     
    128128       
    129129        if ( $hook == 'options-media.php' || $hook == 'settings_page_riq-admin' ) {
     130
    130131            // JS
    131132            wp_enqueue_script( 'jquery-ui-slider' );
     
    148149       
    149150        // Security: Check WP nonce to prevent external use
    150         if ( ! empty( $_POST['riq-integer'] ) && check_admin_referer( 'riq_update_admin_options', 'riq_admin_nonce' ) ) {
    151             if ( ! empty( $_POST['riq-defaults'] ) && 'Reset to Default' == $_POST['riq-defaults'] )
     151        if ( isset( $_POST['riq-integer'] ) && check_admin_referer( 'riq_update_admin_options', 'riq_admin_nonce' ) ) {
     152           
     153            if ( ! empty( $_POST['riq-defaults'] ) && 'Reset to Default' == $_POST['riq-defaults'] ) {
     154               
    152155                $confirm_update = $this->update_plugin_settings( (int)90 );
    153             else
     156               
     157            } else {
     158               
     159                if ( (string)$jpeg_quality == '0' ) // WordPress core does this to avoid empty images
     160                    $jpeg_quality = 1;
     161               
    154162                $confirm_update = $this->update_plugin_settings( $_POST['riq-integer'] );
    155            
    156         } elseif ( ! empty( $_POST['riq-integer'] ) ) {
     163               
     164            }
     165           
     166        } elseif ( isset( $_POST['riq-integer'] ) ) {
     167           
    157168            wp_die( __( 'Invalid: Update without permissions. Please check your login and try again.', 'wp-resized-image-quality' ) );
    158169           
     
    161172        // Get the whole reason this plugin exists
    162173        if ( false === ( $jpeg_quality = get_transient( 'riq_jpeg_quality' ) ) ) {
     174
    163175            $this->riq_options = get_option( 'riq_options' );
    164176           
     
    176188        // Include admin page/HTML output from separate file
    177189        require_once( dirname( __file__ ) . '/templates/riq-admin-page-template.php' );
     190
    178191    }
    179192   
     
    194207        // Get the whole reason this plugin exists
    195208        if ( false === ( $jpeg_quality = get_transient( 'riq_jpeg_quality' ) ) ) {
     209
    196210            $this->riq_options = get_option( 'riq_options' );
    197211           
     
    216230    public function sanitize_riq_media_option( $riq_options ) {
    217231       
    218         if ( ! empty( $_POST['riq-integer'] ) ) {
     232        if ( ( $_POST['riq-integer'] ) ) {
    219233           
    220234            $valid = array();
     
    231245                'JPEG Quality',
    232246                'riq_numeric_error',
    233                 //'Invalid %, must be a number',
    234                 print_r($riq_options),
    235                 //$riq_options,
     247                'Invalid JPEG compression %: The setting must be a number',
     248                //print_r($riq_options),
    236249                'error'
    237250            );
     
    263276    public function update_plugin_settings( $jpeg_quality = 90 ) {
    264277       
     278
     279
     280
    265281        $this->riq_options['jpeg_quality'] = intval( $jpeg_quality );
    266282        update_option( 'riq_options', $this->riq_options );
Note: See TracChangeset for help on using the changeset viewer.