Dotclear

Changeset 1677:61b034ed28a6


Ignore:
Timestamp:
09/01/13 10:04:13 (11 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.5
Message:

Use jpg thumbnails if exist for png images. Addresses #1465

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.media.php

    r1381 r1677  
    299299               $f->media_thumb = array(); 
    300300               $p = path::info($f->relname); 
     301 
    301302               $alpha = ($p['extension'] == 'png') || ($p['extension'] == 'PNG'); 
     303 
    302304               $thumb = sprintf(($alpha ? $this->thumb_tp_alpha : $this->thumb_tp),$this->root.'/'.$p['dirname'],$p['base'],'%s'); 
    303305               $thumb_url = sprintf(($alpha ? $this->thumb_tp_alpha : $this->thumb_tp),$this->root_url.$p['dirname'],$p['base'],'%s'); 
     
    306308               $thumb_url = preg_replace('#\./#','/',$thumb_url); 
    307309               $thumb_url = preg_replace('#(?<!:)/+#','/',$thumb_url); 
     310 
     311               if ($alpha) { 
     312                    $thumb_alt = sprintf($this->thumb_tp,$this->root.'/'.$p['dirname'],$p['base'],'%s'); 
     313                    $thumb_url_alt = sprintf($this->thumb_tp,$this->root_url.$p['dirname'],$p['base'],'%s'); 
     314                    # Cleaner URLs 
     315                    $thumb_url_alt = preg_replace('#\./#','/',$thumb_url_alt); 
     316                    $thumb_url_alt = preg_replace('#(?<!:)/+#','/',$thumb_url_alt); 
     317               } 
    308318                
    309319               foreach ($this->thumb_sizes as $suffix => $s) { 
    310320                    if (file_exists(sprintf($thumb,$suffix))) { 
    311321                         $f->media_thumb[$suffix] = sprintf($thumb_url,$suffix); 
     322                    } elseif ($alpha && file_exists(sprintf($thumb_alt,$suffix))) { 
     323                         $f->media_thumb[$suffix] = sprintf($thumb_url_alt,$suffix); 
    312324                    } 
    313325               } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map