• I Should put in the body of the posts a reference to an image, but I would like use a relative path.

    Now i use a absolute path like this:
    src = “/ wordpress3/wp-content/uploads/2014-2008/2007-10-19.jpg”
     
    Somebody help me.
    Thanks
    greetings
    MG

Viewing 2 replies - 1 through 2 (of 2 total)
  • Praveen a11n

    (@spraveenitpro)

    Automattic Happiness Engineer

    You could use :

    <?php 
    
        $upload_dir = wp_upload_dir();
        src = $upload_dir['baseurl']."/2014-2008/2007-10-19.jpg";
    
    ?>
    Thread Starter gallowp

    (@gallowp)

    Hello spraveenitpro,
    thanks for your reply, I tried to insert your code in the text of my post but after i update disappears and does not work.
    Probably i wrong something.
    Can you help ?
    1000 Thanks
    greetings
    MG

    here a piece of the text of the post :

    ..............

    <img src=”/public/2007-09-24-e.jpg” alt=”Pane e nutella per tutti” />…senza dimenticare l’immancabile merenda con il classico “pane e nutella” per tutti .</p>
     

     

    <?php
    $upload_dir = wp_upload_dir();
    src = $upload_dir[‘baseurl’].”/2014-2008/2007-10-19.jpg”;
    ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to insert an absolute path for the image’ is closed to new replies.