Jump to content

Rootbeer

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Rootbeer's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you very much
  2. Here is what I Am trying to do: Fetch an RSS feed and save it on my server Find all the images in the feed (in the description field Find out the size of the images, calculate a new size keeping the same aspect ratio Update the height/width field of the image in the original feed Heres what I have done so far: Saved the feed in my server Found all the images using preg_match_all() Extracted the image URL using preg_match() Calculated the new size Now how do I update the feed saved in the server? Seems like I have to find the <img> tags again in the feed using regexp and replace them with the new updated <img> tags. I feel like this is not the best way to do it. Can anyone help me out with a more efficient way? Thanks! p.s. Heres my code: // Now find and resize image $regex = '#<img.*src=\".*\"\s\/>#'; preg_match_all($regex, $text, $matches); foreach($matches[0] as $value) { // Extract the image url from the <img> tag $regex = '#http:\/\/www\.website.com\/.*\.(jpg|jpeg|gif|png)#'; preg_match($regex, $value, $imgurl); // Edit $value here. Now want to put $value back into $text // Now run another regexp here searching $text for old $value and replace it with the new $value? }
×
×
  • 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.