Mr Chris Posted March 18, 2010 Share Posted March 18, 2010 Hi All, Wondering if anyone can help. I have three image paths saved into a database ($image1, $image2, $image3) and a big long text string ($the_text) which can contain anything from 800 around 1500 words. Now what I want to do is wrap each image around $the_text. IE: - $image1 a one third down the page - $image2 two thirds down the page - $image3 outputted Last third down the page All depending on how many characters are in the text. Now the best i've come up with is outputting all three images before the text is called out like so: if($image1) { echo '<img class="float:left;" src="'.$image1.'" alt="" />'; } if($image2) { echo '<img class="float:right;margin-top:10px;" src="'.$image2.'" alt="" />'; } if($image3) { echo '<img class="float:left;margin-top:10px;" src="'.$image1.'" alt="" />'; } echo ' <p class="features-text">'.str_replace("\n","</p>\r\n\t\t\t<p class=\"the-text\">",$the_text).'</p> '; But this is far from ideal. Anyone help me achieve the above? Thanks Link to comment https://forums.phpfreaks.com/topic/195691-wrapping-images-around-dynamic-text-called-from-db/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.