|
FAQ | Members List | Calendar | Today's Posts | Search |
Topic Review (Newest First) |
Apr 20th, 2007 06:23 PM | |
Chojin |
Is it possible to do this with CSS? HEY THERE! I've been trucking about with PHP learnings and CSS goings-ons, and I've run into a problem. I want to take an image and have it display in a float in the LOWER-left of a dynamically-sized text box. My initial solution was to have PHP get the height of the image (X), then place it as a relative float after the textbox, then bump it up by X pixels (and by textbox, I mean a table that contains text included from a specified document). However, this creates two problems- 1. The text is obscured by the image - it doesn't wrap around it like normal. 2. The vertical space taken up by where the image would have been if it wasn't bumped up by X pixels remains as blank space. Because the contents and size of the textbox are variable, I need a dynamic solution and not a hack. Any ideas? Code:
// This is the text <?php include("reviews/" . $gameid . "_id_em.txt"); ?> // If an image exists, paste it in the document <? if (file_exists("fanart/" . $gameid . "_t01.jpg")) { ?> // Get the image's dimensions and put them in variables <?php list($imgwidth, $imgheight, $imgtype, $imgattr) = getimagesize("fanart/" . $gameid . "_t01.jpg"); ?> // Place the image below the text and bump it up by the variables <div style="position:relative;top: -<?php echo $imgheight ?>px;"> <img src="<?php echo "fanart/" . $gameid . "_t01.jpg" ?>" /></div> <?php }; ?> |