Einzelnen Beitrag anzeigen
Alt 29.10.2003, 00:54   #4
käptn
Inventar
 
Registriert seit: 04.11.2001
Alter: 45
Beiträge: 2.150


Standard

PHP-Code:
$path '/my/path/'// trailing slash!

function _w($w,$h)
{
    if (
$w 800) {
        
$w round($w/2);
        
$h round($w/2);
    }

    return 
' width="' $w '" height="'$h .'" ';
}

$dir dir($path);
while (
$file $dir->read()) {
    
$file $path.$file;
    if(
is_dir($file)) continue;
    
$new preg_replace(
        
'/\\swidth="?(\\d+)"?\\s+height="?(\\d+)"?/ie',
        
'_w(\\\\1,\\\\2)',
        
implode(''file($file))
    );

    
$fh fopen($file'w');
    
fputs($fh$new);
    
fclose($fh);

Ähnlich in Perl, wahrscheinlich etwas kürzer...

~
____________________________________
LOL - Mein erstes Post im Programmier Forum

MACINTOSH - Most Applications Crash, If Not The Operating System Hangs
käptn ist offline   Mit Zitat antworten