contra10 Posted January 7, 2009 Share Posted January 7, 2009 im trying to have a background color for my image <?php body('background-color: red' ); header('Content-type: ' . $row['type'] .''); imagejpeg($new, null, 85); ?> a body function doesn't work Quote Link to comment Share on other sites More sharing options...
trq Posted January 7, 2009 Share Posted January 7, 2009 There is no such php function as body. Quote Link to comment Share on other sites More sharing options...
contra10 Posted January 7, 2009 Author Share Posted January 7, 2009 my mistake, i must have been trying to call something new...do u know if there is a way though to have a backgorund color to an image...right now my image shows from an iframe and the page color is white...if i use html to change the page color my photo turns back into binary data Quote Link to comment Share on other sites More sharing options...
contra10 Posted January 7, 2009 Author Share Posted January 7, 2009 im trying to get a background colour for my photos but it keeps messing up when i put an actual colour, wheter in html <body bgcolor="black"> outside the php or within the php syntax Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted January 7, 2009 Share Posted January 7, 2009 if you are wanting to place a background color behind the photo so that there is padding around the image so that the background color shows up as if the image is sitting on a background... i would place the image inside a div and set the div to a particular color and give padding to that div Quote Link to comment Share on other sites More sharing options...
contra10 Posted January 7, 2009 Author Share Posted January 7, 2009 i tried inside the syntax and outside with div...if outside i get the image in binary data while inside the syntax <?php $query = mysql_query('SELECT image FROM `tbl_images` WHERE `userid`= "'.$id.'"'); $row = mysql_fetch_assoc($query); $content = $row['image']; $desired_width = 40; $desired_height = 40; $im = imagecreatefromstring($content)or die("Can not select the database: ".mysql_error());; $new = imagecreatetruecolor($desired_width, $desired_height)or die("Can not select the database: ".mysql_error());; $x = imagesx($im); $y = imagesy($im); imagecopyresampled($new, $im, 0, 0, 0, 0, $desired_width, $desired_height, $x, $y)or die("Can not select the database: ".mysql_error());; imagedestroy($im); header('Content-type: ' . $row['type'] .''); echo "<div background-color:green;'>imagejpeg($new, null, 85)</div>"; } ?> i get nothing shown did i place the div syntax wrong Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted January 7, 2009 Share Posted January 7, 2009 change this echo "<div background-color:green;'>imagejpeg($new, null, 85)</div>"; to echo "<div style='background-color:green;'>" . imagejpeg($new, null, 85) . "</div>"; Quote Link to comment Share on other sites More sharing options...
Brian W Posted January 7, 2009 Share Posted January 7, 2009 you said something about using an I frame for displaying the image. You can grab that image with something like: <img src="image.php?ID=<?php echo $id; ?>" /> that would avoid the whole iframe thing. Quote Link to comment Share on other sites More sharing options...
contra10 Posted January 7, 2009 Author Share Posted January 7, 2009 ye that works the way i wanted it too...thanks both of u guys and other way workds as well Quote Link to comment Share on other sites More sharing options...
contra10 Posted January 7, 2009 Author Share Posted January 7, 2009 using ifram i should have set transparency....duh to myself 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.