Jump to content

myszapk

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Posts posted by myszapk

  1. I have a big problem with chanching source paths in my file.I would like to  change src="1.png" and src="2.png" to "C:/wamp/www/Lilie wodne.jpg". I don't know why it doesn't work.
    Here is a source code:
    [code]
    <?php
    $html = '<html><head><title></title></head><body>';
    $html .= '<img src="1.png"><b>PHP Solutions</u>';
    $html .= '<img alt="" src=2.png width=20 height=20>';
    $html .= '</bofy></html>';

    $tidy = tidy_parse_string($html);
    tidy_clean_repair($tidy);
    $html = tidy_get_html($tidy);
    reset_images($html);

    function reset_images(&$html){

    //if tag is <IMG>
    //change source path to "C:/wamp/www/Lilie wodne.jpg"
    //here src = "C:/wamp/www/Lilie wodne.jpg" but
    //but when we return from function attribute:
    //$html->attribute['src'] remains still the same.
    //that is "2.png" and "1.png"
    //what is wrong??

    if($html->id == TIDY_TAG_IMG){
    $html->attribute['src'] = "C:/wamp/www/Lilie wodne.jpg";
    echo $html->attribute['src'];
    //var_dump($node);
    }
    if ($html->hasChildren()){
    //foreach($html->child as $child){
    //reset_images($child);
    for($i=0;$i<count($html->child);$i++)
    reset_images($html->child[$i]);
    }
    }
    echo $html;
    ?> 
    [/code][tt]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.