🔞 ADULT: Changeset/ - Full Archive

Changeset 452660


Ignore:
Timestamp:
10/18/2011 10:54:49 PM (14 years ago)
Author:
alexdunae
Message:

Cleaner handling of file paths

Location:
wp-smushit/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-smushit/trunk/readme.txt

    r450734 r452660  
    11=== WP Smush.it ===
    22Plugin Name: WP Smush.it
    3 Version: 1.4.2
     3Version: 1.4.3
    44Author: Dialect
    55Author URI: http://dialect.ca/?wp_smush_it
  • wp-smushit/trunk/wp-smushit.php

    r450014 r452660  
    22/**
    33 * Integrate the Smush.it API into WordPress.
    4  * @version 1.4.2
     4 * @version 1.4.3
    55 * @package WP_SmushIt
    66 */
     
    1010Description: Reduce image file sizes and improve performance using the <a href="http://smush.it/">Smush.it</a> API within WordPress.
    1111Author: Dialect
    12 Version: 1.4.2
     12Version: 1.4.3
    1313Author URI: http://dialect.ca/
    1414*/
     
    223223function wp_smushit_resize_from_meta_data($meta, $ID = null, $force_resmush = true) {
    224224    $file_path = $meta['file'];
     225
    225226    $store_absolute_path = true;
    226227    $upload_dir = wp_upload_dir();
     
    235236  if ( $force_resmush || wp_smushit_should_resmush(  @$meta['wp_smushit'] ) ) {
    236237      list($file, $msg) = wp_smushit($file_path);
    237     $meta['file'] = $file;
    238238    $meta['wp_smushit'] = $msg;
    239239  }
    240 
    241 
     240 
    242241    // strip absolute path for Wordpress >= 2.6.2
    243242    if ( FALSE === $store_absolute_path ) {
     
    250249
    251250    // meta sizes don't contain a path, so we calculate one
    252     $base_dir = dirname($file_path) . '/';
    253 
     251    $base_dir = trailingslashit( dirname($file_path) );
    254252
    255253    foreach($meta['sizes'] as $size => $data) {
     
    258256      }
    259257
    260         list($smushed_file, $results) = wp_smushit($base_dir . $data['file']);
    261         $meta['sizes'][$size]['file'] = str_replace($base_dir, '', $smushed_file);
     258        list($smushed_file, $results) = wp_smushit( $base_dir . wp_basename( $data['file'] ) );
    262259        $meta['sizes'][$size]['wp_smushit'] = $results;
    263260    }
    264 
    265261    return $meta;
    266262}
Note: See TracChangeset for help on using the changeset viewer.