WCM - Das österreichische Computer Magazin Forenübersicht
 

Zurück   WCM Forum > Rat & Tat > Linux, UNIX, Open Source

Linux, UNIX, Open Source Rat & Tat bei Problemen und Fragen rund um GNU/Linux, BSD und sonstige UNIXe

Microsoft KARRIERECAMPUS

Antwort
 
Themen-Optionen Ansicht
Alt 28.10.2003, 19:37   #1
jak
Inventar
 
Registriert seit: 13.06.2001
Beiträge: 1.830


Standard >800 Dateien ändern

Selbe Situation wie da: http://www.wcm.at/forum/showthread.php?threadid=114431

Gibt es eine Methode um in vielen Dateien folgendes zu ändern:
"Wenn das was rechts von WIDTH= zwischen " und " steht größer als 800 ist soll es, und das was nach HEIGHT= zwischen " und " steht halbiert werden.

Bin für jeden tip dankbar

Jak
____________________________________
Join the DNRC | Godwin\'s Law (thx@stona)
Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing.
\"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra)
jak ist offline   Mit Zitat antworten
Alt 28.10.2003, 20:19   #2
käptn
Inventar
 
Registriert seit: 04.11.2001
Alter: 45
Beiträge: 2.150


Standard

Steht height immer nach width?

~
____________________________________
LOL - Mein erstes Post im Programmier Forum

MACINTOSH - Most Applications Crash, If Not The Operating System Hangs
käptn ist offline   Mit Zitat antworten
Alt 28.10.2003, 20:47   #3
jak
Inventar
 
Registriert seit: 13.06.2001
Beiträge: 1.830


Standard

Ja, eine Zeile hat immer diese Form:
[img]irgendetwas[/img]
z.B.:
[img]large/photo.jpg[/img]

Jak
____________________________________
Join the DNRC | Godwin\'s Law (thx@stona)
Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing.
\"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra)
jak ist offline   Mit Zitat antworten
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
Alt 30.10.2003, 17:03   #5
jak
Inventar
 
Registriert seit: 13.06.2001
Beiträge: 1.830


Standard

Vielen Dank, hat einwandfrei funktioniert. (Obwohl sich ein Tippfehler eingeschlichen hat:
Code:
if ($w > 800) { 
        $w = round($w/2); 
        $h = round($h/2); //nicht $w/2
    }
Jak
____________________________________
Join the DNRC | Godwin\'s Law (thx@stona)
Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing.
\"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra)
jak ist offline   Mit Zitat antworten
Antwort


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.

Gehe zu


Alle Zeitangaben in WEZ +2. Es ist jetzt 21:37 Uhr.


Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Forum SEO by Zoints
© 2009 FSL Verlag