Plugin Directory

Changeset 2325721


Ignore:
Timestamp:
06/17/2020 09:14:32 AM (6 years ago)
Author:
greencp
Message:

v2.3.3 - fix in determining local image path

Location:
wp-performance-pack/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-performance-pack/trunk/modules/dynamic_images/class.wppp_serve_image.php

    r2258214 r2325721  
    6464    function get_local_filename() {
    6565        if ( $this->localfilename === null ) {
    66             $uploads_dir            = wp_upload_dir();
    67             $temp                   = parse_url( $uploads_dir['baseurl'] );
    68             $upload_path            = $temp['path'];
    69             $findfile               = str_replace( $upload_path, '', $this->filename );
    70             $this->localfilename    = $uploads_dir['basedir'] . $findfile;
    71             $this->localfiletime    = filemtime( $this->localfilename );
    72 
     66            $uploads_dir = wp_upload_dir();
     67            $upload_path = parse_url( $uploads_dir[ 'baseurl' ] )[ 'path' ];
     68
     69            $pos = strpos( $this->filename, $upload_path );
     70            if ( $pos !== false ) {
     71                $this->localfilename = $uploads_dir['basedir'] . substr( $this->filename, $pos + strlen( $upload_path ) );
     72                $this->localfilename_scaled = $uploads_dir['basedir'] . substr( $this->filename_scaled, $pos + strlen( $upload_path ) );
     73            } else {
     74                $this->exit404( 'Error getting local file name for "' . $this->filename . '"' );
     75                return false;
     76            }
    7377            if ( !file_exists( $this->localfilename ) ) {
    7478                $this->exit404( 'File "' . $this->localfilename . '" not found' );
    7579                return false;
    7680            }
    77             $findfile                   = str_replace( $upload_path, '', $this->filename_scaled );
    78             $this->localfilename_scaled = $uploads_dir['basedir'] . $findfile;
     81            $this->localfiletime    = filemtime( $this->localfilename );
    7982        }
    8083        return true;
     
    208211                    // change save folder
    209212                    $newfile = WP_CONTENT_DIR . '/wppp/images' . substr( $newfile, $uplen, strlen( $newfile ) - $uplen );
    210                     wp_mkdir_p( dirname( $newfile ) );
     213                    if ( !$this->wppp->options[ 'dynamic_images_nosave' ] )
     214                        wp_mkdir_p( dirname( $newfile ) );
    211215                }
    212216                if ( !$this->wppp->options[ 'dynamic_images_nosave' ] && $this->wppp->options[ 'dynimg_serve_method' ] === 'wordpress' && file_exists( $newfile ) ) {
  • wp-performance-pack/trunk/modules/dynamic_images/serve-dynamic-images.php

    r2258139 r2325721  
    9696    }
    9797
    98 
    99 
    10098    function prepare_resize() {
    10199        if ( !$this->wppp->options['dynamic_images_nosave'] ) {
  • wp-performance-pack/trunk/readme.txt

    r2325169 r2325721  
    55Tested up to: 5.4.2
    66Requires PHP: 5.3
    7 Stable tag: 2.3.2
     7Stable tag: 2.3.23
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    128128== Changelog ==
    129129
     130= 2.3.3 =
     131* [dynimg] "Cache folders" for intermediate images aren't created anymore if saving of intermediate images is disabled.
     132* [dynimg] Improved method for determining local file path for requested images.
     133
    130134= 2.3.2 =
    131135* [wpfeatures] Additional script is deregistered when heartbeat is deactivated
  • wp-performance-pack/trunk/wp-performance-pack.php

    r2325169 r2325721  
    44    Plugin URI: http://wordpress.org/plugins/wp-performance-pack
    55    Description: Performance optimizations for WordPress. Improve localization performance and image handling, serve images through CDN. 
    6     Version: 2.3.2
     6    Version: 2.3.3
    77    Text Domain: wp-performance-pack
    88    Author: Björn Ahrens
     
    130130     * @const string
    131131     */
    132     const wppp_version = '2.3.2';
     132    const wppp_version = '2.3.3';
    133133
    134134    /**
Note: See TracChangeset for help on using the changeset viewer.