PHP - Moved: Trouble With Background Image
This topic has been moved to CSS Help.
http://www.phpfreaks.com/forums/index.php?topic=349151.0 Similar TutorialsThis topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=319094.0 This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=355565.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=331191.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=347058.0 This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=342058.0 This topic has been moved to PHP Math Help. http://www.phpfreaks.com/forums/index.php?topic=321684.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=306321.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=330011.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=351506.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=322457.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=313679.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=319295.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=351914.0 I am having trouble with displaying an image from a url. In the following code if I echo out $test I get the url of the image. However, in the current code I am trying to display the image, but the only thing that gets displayed is a small broken image in the upper left.
$html = file_get_contents($website.$criteria); $dom = new DOMDocument; @$dom->loadHTML($html); $links = $dom->getElementsByTagName('img'); header('Content-Type: image/png'); foreach ($links as $link){ $test = $link->getAttribute('src'); echo file_get_contents($test); }image that gets displayed: http://imgur.com/epfF3wJ Hello again, i need to do a form that uploads an image, makes a thumbnail of it and puts a watermark image and text on the thumbnail.. Iv managed to do the uploading part, making the thumbnail, then making a watermarked thumbnail (with image) , and i need some help with the watermark text part.. What im thinking of - generate a text image, then apply it to the watermark, then add the watermark with text to the thumbnail. This is the function i used for the watermark image: <?php function watermark($original_image,$original_watermark,$destination="") { $image=imagecreatefromjpeg($original_image); list($imagewidth,$imageheight)=getimagesize($original_image); $watermark = imagecreatefrompng($original_watermark); list($watermarkwidth,$watermarkheight)=getimagesize($original_watermark); if($watermarkwidth>$imagewidth || $watermarkheight>$imageheight) { $water_resize_factor = $imagewidth / $watermarkwidth; $new_watermarkwidth = $watermarkwidth * $water_resize_factor; $new_watermarkheight = $watermarkheight * $water_resize_factor; $new_watermark = imagecreatetruecolor($new_watermarkwidth , $new_watermarkheight); imagealphablending($new_watermark , false); imagecopyresampled($new_watermark , $watermark, 0, 0, 0, 0, $new_watermarkwidth, $new_watermarkheight, $watermarkwidth, $watermarkheight); $watermarkwidth = $new_watermarkwidth; $watermarkheight = $new_watermarkheight; $watermark = $new_watermark; } $startwidth = ($imagewidth - $watermarkwidth) / 2; $startheight = ($imageheight - $watermarkheight) / 2; imagecopy($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight); if(!empty($destination)) imagejpeg($image,$destination); else imagejpeg($image); } ?> Can i insert in this function something like this? (the "Text" would appear on top of the watermark image in the middle) : <?php // Create the canvas $canvas = imagecreate( 150, 80 ); // First colour - this will be the default colour for the canvas // $light_blue = imagecolorallocate( $canvas, 176, 226, 255 ); // The second colour - to be used for the text $black = imagecolorallocate( $canvas, 0, 0, 0 ); // Path to the font you are going to use $font = "verdana.ttf"; // Text to write $text = "Text"; // Font size $size = "40"; // Add the text to the canvas imageTTFText( $canvas, $size, 0, 15, 60, $black, $font, $text ); // Save as Text.jpg imagejpeg( $canvas, "Text.jpg" ); // Clear the memory of the tempory image ImageDestroy( $canvas ); ?> thanks in advance. So I am trying to pull the first image that was uploaded to the database. But for some reason this only works part of the time and if you delete any image in the database it seems to just pic another another random one. Any suggestions? <?php { $row = getad(); header("Content-type: image/jpeg"); $pic = ($row['image']); print "$pic"; } function getad() { $ads = array(); mysql_connect("localhost","******","********"); mysql_select_db("users"); $query = "SELECT image FROM image_ads"; $result = mysql_query($query); $i = 0; while($row = mysql_fetch_array($result)) { $i ++; $ads[$i] = $row; } $id = date("z"); $index = $id % $i + 1; mysql_close(); return $ads[$index]; } ?> This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=351137.0 This topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=354424.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=352099.0 This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=333585.0 |