babyrats Posted January 11, 2010 Share Posted January 11, 2010 First a big hi to everyone atphpfreaks.com And a warning, I am pretty new to coding, with only a months worth of php studying. So please if you are able to answer, dumb it down like you are talking to a baby. I am making a review site (to learn) where users can submit their own reviews. If they put a image into a textbox the image URL gets sent to resize.php with the image url in querystring. All the review is held in $review and I was wondering if there is a way for me to grab all URLs in that variable before getting resized so I can also make the resized image a link. E.G <a href="link_to_original.jpg"><img src="resizedImage.jpg" /></a> If this is a awful explanation please tell me and I will try to re-write it. Always have been bad at explaining *sigh* Link to comment https://forums.phpfreaks.com/topic/188061-getting-img-urls-from-a-large-string/ Share on other sites More sharing options...
cags Posted January 11, 2010 Share Posted January 11, 2010 I assume your E.G is an example of what you want the output to look like? An example of the contents of $review would be useful in getting your point across. Link to comment https://forums.phpfreaks.com/topic/188061-getting-img-urls-from-a-large-string/#findComment-992865 Share on other sites More sharing options...
babyrats Posted January 11, 2010 Author Share Posted January 11, 2010 Yes the example is what I want to happen. example text: $review = 'This is a example review for test purposes. this will be a resized image [img=http://image.jpg] (will return <img src="resize?file=image.jpg" />'; At the moment the only thing that is done with review is : $imageOpen = str_replace('[img]http://, '<img src="location/resize.php?file=', $string); $imageClose = str_replace('[/img]', '"/>', $imageOpen); but i also what the str_replace to add the link to the original file when the tag is used. Hope this clears things a bit more. thanks for any help in advance. Link to comment https://forums.phpfreaks.com/topic/188061-getting-img-urls-from-a-large-string/#findComment-992882 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.