PDA

View Full Version : Wrapping images alongside dynamic text?



stfc_boy
Mar 18th, 2010, 11:10 PM
Hello,

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 called from rows in mySQL database.

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

Fou-Lu
Mar 18th, 2010, 11:15 PM
Positioning is an HTML/CSS issue, not a PHP one. Moving from PHP to HTML/CSS forum.
What the client side guys will want is either a link to you're site or the html source of the problem in question.