PHP String Function Related Problem

Discussion in 'PHP' started by B R Bhatt, May 22, 2008.

  1. #1
    Any body can provide any idea to solve my PHP problem. My problem listed below:

    ****************************************************

    Please see below line of html .

    <table width="100%" border="0">
    <tr>

    <td>The 2nd NATTA Himalayan International <img src="file:///D|/wamp/www/bhoj/asian_exped_new_update/images/pic_06.jpg" width="101" height="28" />Travel Mart 2007 was held in Kathmandu from 11-13 May,<img src="file:///D|/wamp/www/bhoj/asian_exped_new_update/images/pic_01.jpg" width="253" height="124" /></td>

    </tr>
    </table>

    *******************************************************


    Now I would like to delete the path of the both images (file:///D|/wamp/www/bhoj/asian_exped_new_update/images/) and add extra folder name: uploadfile . I mean I would like to keep image name with uploadfile name in database (uploadfile /pic_06.jpg) and (uploadfile / pic_01.jpg). That is

    ******************************************************

    Output


    <table width="100%" border="0">

    <tr>

    <td>The 2nd NATTA Himalayan International <img src="uploadfile/pic_06.jpg" width="101" height="28" />Travel Mart 2007 was held in Kathmandu from 11-13 May,<img src="uploadfile/pic_01.jpg" width="253" height="124" /></td>

    </tr>

    </table>

    ***************************************************

    Please try to share your knowledge to solve my problem by using PHP scripts.
    I am waiting for your reply. Please try to give your logic.
     
    B R Bhatt, May 22, 2008 IP
  2. elias_sorensen

    elias_sorensen Well-Known Member

    Messages:
    852
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Put all your urls into a variable and explode them. Then take the last one (which should be the filename), and put that in a variable. Then put uploadfile/ in front of it.

    I think you could also use ob_start(); to change the content???
     
    elias_sorensen, May 23, 2008 IP
  3. B R Bhatt

    B R Bhatt Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hello elias_sorensen,

    I can't able to solve my problem .
    So could you please help me..
     
    B R Bhatt, May 25, 2008 IP
  4. sylsft

    sylsft Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The easiest way to do this would be to use:
    $newSource = str_replace('file:///D|/wamp/www/bhoj/asian_exped_new_update/images/', 'uploadfile/', $source);
     
    sylsft, May 27, 2008 IP
  5. handsinpanty

    handsinpanty Banned

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i second that
     
    handsinpanty, May 27, 2008 IP
  6. B R Bhatt

    B R Bhatt Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Any body can provide any idea to solve my PHP problem. My problem listed below:

    ****************************************************

    Please see below line of html .

    <table width="100%" border="0">
    <tr>

    <td>The 2nd NATTA Himalayan International <img src="file:///D|/wamp/www/bhoj/asian_exped_new_update/images/pic_06.jpg" width="101" height="28" />Travel Mart 2007 was held in Kathmandu from 11-13 May,<img src="file:///D|/wamp/www/bhoj/asian_exped_new_update/images/pic_01.jpg" width="253" height="124" /></td>

    </tr>
    </table>

    Note: I don’t know how many images are there and above information showld be taken through Text Area .

    *******************************************************


    Now I would like to delete the path of the both images (file:///D|/wamp/www/bhoj/asian_exped_new_update/images/) and add extra folder name: uploadfile . I mean I would like to keep image name with uploadfile name in database (uploadfile /pic_06.jpg) and (uploadfile / pic_01.jpg). That is

    ******************************************************

    Output


    <table width="100%" border="0">

    <tr>

    <td>The 2nd NATTA Himalayan International <img src="uploadfile/pic_06.jpg" width="101" height="28" />Travel Mart 2007 was held in Kathmandu from 11-13 May,<img src="uploadfile/pic_01.jpg" width="253" height="124" /></td>

    </tr>

    </table>

    ***************************************************


    Please try to share your knowledge to solve my problem by using PHP scripts.
    I am waiting for your reply. Please try to give your logic.
     
    B R Bhatt, Jun 3, 2008 IP