All pastes #444529 Raw Edit

Stuff

public text v1 · immutable
·published 2007-04-17 11:37 UTC
rendered paste body
// AJOUTER PAR MOI
       $cheminsite1 = 'http://rose.de.paris.free.fr/Victoria_Silvstedt/albums/';
        $cheminsite2 = 'http://www.unautresite.fr/unrepertoire/';
if (    ($pic_row['filepath'] == 'Couvertures_Adultes_Diverses/')        // ici c'est le nom du répertoire sur le ftp.
     or ($pic_row['filepath'] == 'blabla1/')         // ici c'est le nom d'un autre répertoire sur le ftp (il n'existe pas, mais c'est pour prévoir le cas avec plusieurs albums).                                                                                 
     or ($pic_row['filepath'] == 'blabla2/')         // et encore un autre (qui n'existe pas non plus).
        )
  { $filepathname = $cheminsite1.path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);}

 elseif(   ($pic_row['filepath'] == 'album100/')        // ça ne sers à rien mais c'est pour prévoir l'utilisation de plusieurs serveurs externes
     or ($pic_row['filepath'] == 'album200/')         // ça ne sert toujours à rien                         
     or ($pic_row['filepath'] == 'album300/')         // et toujours pour rien
    )
  { $filepathname = $cheminsite2.path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);}
else        
  { $filepathname = null;}
$testuurl = $cheminsite1.path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);
echo $testuurl;
// echo '<img src="'.$testuurl.'"></img>';
//FIN AJOUT
        $mime_content = cpg_get_type($pic_row['filename']);
        $pic_row = array_merge($pic_row,$mime_content);

        $filepathname = null;

        // Code to handle custom thumbnails
        // If fullsize or normal mode use regular file
        if ($mime_content['content'] != 'image' && $mode== 'normal') {
                $mode = 'fullsize';
        } elseif (($mime_content['content'] != 'image' && $mode == 'thumb') || $system_pic) {
                $thumb_extensions = Array('.gif','.png','.jpg');
                // Check for user-level custom thumbnails
                // Create custom thumb path and erase extension using filename; Erase filename's extension
                $custom_thumb_path = $url_prefix[$pic_row['url_prefix']].$pic_row['filepath'].$pic_prefix[$mode];
                $file_base_name = str_replace('.'.$mime_content['extension'],'',basename($pic_row['filename']));
                // Check for file-specific thumbs
                foreach ($thumb_extensions as $extension) {
                        if (file_exists($custom_thumb_path.$file_base_name.$extension)) {
                                $filepathname = $custom_thumb_path.$file_base_name.$extension;
                                break;
                        }
                }
                if (!$system_pic) {
                        // Check for extension-specific thumbs
                        if (is_null($filepathname)) {
                                foreach ($thumb_extensions as $extension) {
                                        if (file_exists($custom_thumb_path.$mime_content['extension'].$extension)) {
                                                $filepathname = $custom_thumb_path.$mime_content['extension'].$extension;
                                                break;
                                        }
                                }
                        }
                        // Check for content-specific thumbs
                        if (is_null($filepathname)) {
                                foreach ($thumb_extensions as $extension) {
                                        if (file_exists($custom_thumb_path.$mime_content['content'].$extension)) {
                                                $filepathname = $custom_thumb_path.$mime_content['content'].$extension;
                                                break;
                                        }
                                }
                        }
                }
                // Use default thumbs
                if (is_null($filepathname)) {
                               // Check for default theme- and global-level thumbs
                               $thumb_paths[] = $THEME_DIR.'images/';                 // Used for custom theme thumbs
                               $thumb_paths[] = 'images/';                             // Default Coppermine thumbs
                               foreach ($thumb_paths as $default_thumb_path) {
                                       if (is_dir($default_thumb_path)) {
                                               if (!$system_pic) {
                                                       foreach ($thumb_extensions as $extension) {
                                                               // Check for extension-specific thumbs
                                                               if (file_exists($default_thumb_path.$CONFIG['thumb_pfx'].$mime_content['extension'].$extension)) {
                                                                       $filepathname = $default_thumb_path.$CONFIG['thumb_pfx'].$mime_content['extension'].$extension;
                                                                       break 2;
                                                               }
                                                       }
                                                       foreach ($thumb_extensions as $extension) {
                                                               // Check for media-specific thumbs (movie,document,audio)
                                                               if (file_exists($default_thumb_path.$CONFIG['thumb_pfx'].$mime_content['content'].$extension)) {
                                                                       $filepathname = $default_thumb_path.$CONFIG['thumb_pfx'].$mime_content['content'].$extension;
                                                                       break 2;
                                                               }
                                                       }
                                               } else {
                                                       // Check for file-specific thumbs for system files
                                                       foreach ($thumb_extensions as $extension) {
                                                               if (file_exists($default_thumb_path.$CONFIG['thumb_pfx'].$file_base_name.$extension)) {
                                                                       $filepathname = $default_thumb_path.$CONFIG['thumb_pfx'].$file_base_name.$extension;
                                                                       break 2;
                                                               }
                                                       }
                                               }
                                       }
                               }
                }
                $filepathname = path2url($filepathname);
        }

        if (is_null($filepathname)) {
            $filepathname = $url_prefix[$pic_row['url_prefix']]. path2url($pic_row['filepath']. $pic_prefix[$mode]. $pic_row['filename']);
        }

        // Added hack:  "&& !isset($pic_row['mode'])" thumb_data filter isn't executed for the fullsize image
        if ($mode == 'thumb' && !isset($pic_row['mode'])) {
            $pic_row['url'] = $filepathname;
            $pic_row['mode'] = $mode;
            $pic_row = CPGPluginAPI::filter('thumb_data',$pic_row);
        } elseif ($mode != 'thumb') {
            $pic_row['url'] = $filepathname;
            $pic_row['mode'] = $mode;
        } else {
            $pic_row['url'] = $filepathname;
        }

        return $pic_row['url'];
}