Zum Inhalt springen

Blackbenji

Mitglieder
  • Gesamte Inhalte

    1
  • Benutzer seit

  • Letzter Besuch

Beiträge von Blackbenji

  1. hallo,

    ich versuche mittels match und replace bilder die in einem %7Boption%7D-TAG sind zu finden und zu ersetzen.

    Beispiel:

    $content = 'Das hier ist ein Contenteintrag
    [IMG]small_Bildschirmfoto 2012-08-26 um 14.08.20.png[/IMG]
    [IMG]small_Bildschirmfoto 2012-08-27 um 21.36.00.png[/IMG]
    [IMG]small_Bildschirmfoto 2012-08-27 um 22.12.00.png[/IMG]';[/PHP]

    Der Aufruf wäre dann:

    [PHP] if(preg_match_all("/\[IMG\](.*)\[\/IMG\]/", $text, $hits) > 0) {
    foreach( $hits as $i => $k ) {
    $fullmatch = $hits[0][$i];
    $filename = $hits[1][$i];
    $text = str_replace($fullmatch, $this->media->checkFileExist($filename), $text);
    }
    }

    über media wird geprüft ob das Bild existiert und dann entsprechend als html-tag zurück gegeben.

    mein problem ist nun, das ich die ersten 2 bilder umgewandelt bekomme, bild 3 wird nicht umgewandelt.

    var_dump sieht ok aus:

        array(2) {
    [0]=>
    array(3) {
    [0]=>
    string(58) "[IMG]small_Bildschirmfoto 2012-08-26 um 14.08.20.png[/IMG]"
    [1]=>
    string(58) "[IMG]small_Bildschirmfoto 2012-08-27 um 21.36.00.png[/IMG]"
    [2]=>
    string(58) "[IMG]small_Bildschirmfoto 2012-08-27 um 22.12.00.png[/IMG]"
    }
    [1]=>
    array(3) {
    [0]=>
    string(47) "small_Bildschirmfoto 2012-08-26 um 14.08.20.png"
    [1]=>
    string(47) "small_Bildschirmfoto 2012-08-27 um 21.36.00.png"
    [2]=>
    string(47) "small_Bildschirmfoto 2012-08-27 um 22.12.00.png"
    }
    }[/PHP]

    hat jemand eine Idee?

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...