plexus Posted June 23, 2007 Share Posted June 23, 2007 Hi all, I've got the following HTML codes stored in a variable read off from some template tags: <img alt="Image Title" title="Image Title" src="http://www.somedomain.com/photos/category/image_name.jpg" width="480" height="360" /> I would like to know how can I use PHP to extract out the absolute path of the src portion and assign it to a variable. /photos/category/image_name.jpg Thanks Quote Link to comment Share on other sites More sharing options...
VHPirie Posted June 23, 2007 Share Posted June 23, 2007 Not sure bout this coz im a complete newbie, but there's some sort of function that can check a number of characters from the start of a selected text, and also do the same for the end...and I'm guessing it could remove them also...if u know wat i mean. Just had a look through my php stuff and here's wat I used in a file upload script, basically it checked the last 4 characters of the filename (.php, .exe etc etc). (strcasecmp(substr("$file_name", -4), ".php") == 0) Not sure if this is any help but just thought I would try and contribute Quote Link to comment Share on other sites More sharing options...
chigley Posted June 23, 2007 Share Posted June 23, 2007 parse_url() echo parse_url("http://www.somedomain.com/photos/category/image_name.jpg", PHP_URL_PATH); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.