PHP - Image Showing As Text
hey, i'm trying to add a watermark to pictures that show up, however it is only showing as text
here is the code $watermark = imagecreatefrompng('watermark1.png'); $image = imagecreatefromjpeg("/userImages/big/".$pic); imagecopymerge($image, $watermark, 5, 5, 0, 0, 135, 35, 100); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); also, where i fould how to do this, said u have to put a header('content-type: image/jpeg'); code at the top of the page or else it would read as text, however, when i do that, the whole page disappears except for a question mark thing indicating a picture should be there? what do i do?? Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=326995.0 I just can not get my head around this one at all. I have copied exactly the same code from my own template site and added in new content to the head, main body and footer and no matter what I change I can not get the footer text to show the same on a mobile and a pc like my site I took the code from does. The size of the text just goes large on mobiles, yet the same code is used apart from the slight formatting differences, it should still show the text the same. I opted to copied the resulting source code from the browser for both my site and the new site i am doing and stripped out the main content and header and left just the footer and the main body container html for both and my own site show perfectly on all but still the new site is not playing ball. Below is the code for the new site. Can anyone spot anything that I may have missed that is causing the text to show differently (larger) in the footer on mobile devices. New site <!DOCTYPE html> <html lang="en"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="keywords" content=""> <meta name="description" content=""> <style> body { font-family: Verdana, Arial, Helvetica, sans-serif; color: #464646; text-decoration: none; background-color: #8C8C8C; margin: 0em; padding: 1.125em; } a, a:visited { color: #164365; text-decoration: underline; } a:hover { color: #6F6F6F; text-decoration: none; } .clear { clear: both; } #main { width: 46.188em; margin:auto; } #main-inner { padding: 0em 1.063em 0.313em 1.063em; border: 0em solid red; min-height: 12.5em; background-color: #FFFFFF; } #footer { margin: 0 auto; clear: both; /*font-size: 0.74em;*/ color: #FFFFFF; text-align: center; width: 46.188em; border: 0.1em solid #ddd; } /* 727 */ #footer a:link, #footer a:visited { color: #FFFFFF; text-decoration: none; } #footer a:hover { color: #FFFFFF; text-decoration: underline; } </style> <meta name="ROBOTS" content="INDEX, FOLLOW"> <link rel="icon" href="favicon.ico" type="image/x-icon"> </head> <body> <div id="main"> <div id="main-inner"> </div> <div class="clear"></div> </div> <div id="footer"> <div style="margin: 0em; text-align: center; font-size: 9pt; border: 0px solid #000;"> <a href="#">clickable link one</a> | <a href="#">clickable link two</a> | <a href="#">clickable link three</a> | <a href="#">clickable link four</a> | <a href="#">clickable link five</a> |© 2014 my shop ™ </div> </div> </body> </html> and just to show what my original code does.. <!DOCTYPE html> <html lang="en"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="keywords" content=""> <meta name="description" content=""> <style> body { font-family: Verdana, Arial, Helvetica, sans-serif; color: #464646; text-decoration: none; background-color: #8C8C8C; margin: 0em; padding: 1.125em; } a, a:visited { color: #164365; text-decoration: underline; } a:hover { color: #6F6F6F; text-decoration: none; } .clear { clear: both; } #main { width: 46.188em; margin:auto; } #main-inner { padding: 0em 1.063em 0.313em 1.063em; border: 0em solid red; min-height: 12.5em; background-color: #FFFFFF; } #footer { margin: 0em auto; clear: both; color:#FFFFFF; text-align: center; padding: 0em 0em 0em 0em; width: 46.188em; border: 0em dashed #ddd; } #footer a:link, #footer a:visited { color: #FFFFFF; text-decoration: none; } #footer a:hover { color: #FFFFFF; text-decoration: underline; } </style> <meta name="ROBOTS" content="INDEX, FOLLOW"> </head> <body> <div id="main"> <div id="main-inner"> </div> <div class="clear"></div> </div> <div id="footer"> <div style="float: left; width: 6em; border: 0em solid #000;"> </div> <div style="float: left; width: 130px; font-size: 7pt; border: 0px solid #000;"> </div> <div style="float: left; width: 275px; font-size: 8pt; border: 0px solid #000;"> <div style="float: left; width: 200px; border: 0px solid #000;"> © <abbr title="">My company</abbr> </div> <div style="float: left; width: 20px; border: 0px solid #000;"> <a href="http://www.realistichostings.com/sitemap.xml" target="_blank" style="text-decoration: none;">sitemap</a> </div> <div class="clear"></div> designed & hosted by <abbr title="">More footer text</abbr><br>images are copyright of their respective owners </div> </div> </body> </html> I have just started updating my wordpress website using PDO. For some unknown reason, grabbing text from mysql and using 'echo' to display the data does not work. Here is my code:
global $wpdb;
$symbol = get_query_var('name');
$result = $wpdb->get_row("SELECT about FROM wp_data WHERE symbol = '{$symbol}'");
echo $result->about;
I used a foreach loop and echoed all data and everything shows up except for the "TEXT" field (I only have one TEXT column).
Please help! Thanks in advance.
Am adding text with paragraphs into my database but when i view that data on another page it's just one big block of text. :S Anyone no how i can stop this? I'm having an issue with an image not showing up using firefox. All other major browsers work. Query: $imgpath=(mysql_result($result,0,"imgpath")); Below is the code to display the image: <img alt="" height="210" width="709" src="<?php echo $imgpath; ?>"/> Any suggestions will be appreciated. Can anyone see anything wrong with this? <?php $filename = "aircraft/".$reg."1.jpg"; ?> Its meant to be aircraft/xxx1.jpg Thanks This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=314084.0 Hi, I deleted my image in the server folder, but still my image is showing, what might be the problem, Confused, I have cleared my browser cache and restarted, but nothing helps me, if anyone have idea about this pls share with me Thanks, Code: [Select] echo '<img src="data:image/jpg/png/jpeg;base64,' . base64_encode( $row['image'] ) . '" height="150" />'; This is showing up images great in firefox, safari and chrome, but in internet explorer it shows a nice red cross, and I assume it is because of the encoding? Does anyone know how to get working in internet explorer as well? Pretty urgent job! Much appreciated for your help! Hiya all, Firstly thanks for the previous help with the arrays and that... you guys (or girls) ROCK ! But now I am stuck... lol. I am creating a simple motor dealer script for a friend with a garage and a few cars. The idea is... they fill in the form... upload the image(s) and then it adds it in to the database and displays the info on the page with other cars. So far I have got it to array all the info in the database how I want (thanks to you lot !). Now I need to add another box on the add vehicle page to upload photos and then on the show vehicles page I need it to show the uploaded photos next to the vehicles info. This is what I have so far: showvehicles.php: <HTML> <HEAD> <TITLE>Barry Ottley Motor Co - Quality Used Motors - Stanford-Le-Hope, Essex</TITLE> </HEAD> <BODY LINK="#000000" ALINK="#000000" VLINK="#000000"> <CENTER><IMG SRC="logo.jpg"></CENTER> <CENTER> <TABLE WIDTH="840" CELLPADDING="0" CELLSPACING="0" BORDER="0"> <TR> <TD WIDTH="186" valign="top"> <BR> <CENTER><A HREF="index.html"><IMG SRC="homepage.jpg" alt="Homepage" border="0"></A></CENTER> <CENTER><A HREF="showroom.php"><IMG SRC="showroom.jpg" alt="Our Online Showroom" border="0"></A></CENTER> <CENTER><A HREF="location.html"><IMG SRC="ourlocation.jpg" alt="Our location" border="0"></A></CENTER> <CENTER><A HREF="aboutus.html"><IMG SRC="aboutus.jpg" alt="About Us" border="0"></A></CENTER> <CENTER><A HREF="contactus.php"><IMG SRC="contactus.jpg" alt="Contact Us" border="0"></A></CENTER> </TD> <TD WIDTH="30" valign="top"> </TD> <TD valign="top"> <FONT SIZE="2" FACE="ARIAL"> <CENTER><B>Current Showroom</B></CENTER> <BR> <!-- VIEWING BIT --> <?php include('dbconnect.php') ?> <?php // Make a MySQL Connection $query = "SELECT * FROM cars"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=100% BORDER=0>"; echo "<TR />"; echo "<TD WIDTH=30% VALIGN=TOP />"; echo " <IMG SRC=immg.gif /> "; echo "<br />"; echo "</TD>"; echo "<TD WIDTH=10 VALIGN=TOP />"; echo " "; echo "</TD>"; echo "<TD />"; echo "<font size=3 face=arial /><B >"; echo $row['CarPrice']; echo "</B><font size=2 face=arial />"; echo "<br />"; echo $row['CarTitle']; echo "<br />"; echo "Vehicle Type: "; echo $row['CarName']; echo "<br />"; echo "Vehicle Mileage: "; echo $row['CarMiles']; echo "<br />"; echo "Description: "; echo "<br />"; echo "<br />"; echo $row['CarDescription']; echo "<br />"; echo "</TD>"; echo "</TR>"; echo "</TABLE>"; echo "<hr WIDTH=100% COLOR=BLACK />"; } ?> <!-- END OF VIEWING BIT --> </TD> </TR> </TABLE> <BR><BR><BR><BR> <CENTER><FONT FACE="VERDANA" SIZE="1"> This website was designed and is hosted by <A HREF="http://www.IRCDirect.co.uk">IRC Direct Website Design™</A> 2010 </CENTER> <BR> <CENTER><A HREF="admin.php">Employee Area</A> </BODY> </HTML> AddVehicle.php <HTML> <HEAD> <TITLE>Barry Ottley Motor Co - Quality Used Motors - Stanford-Le-Hope, Essex</TITLE> </HEAD> <BODY LINK="#000000" ALINK="#000000" VLINK="#000000"> <CENTER><IMG SRC="logo.jpg"></CENTER> <CENTER> <TABLE WIDTH="840" CELLPADDING="0" CELLSPACING="0" BORDER="0"> <TR> <TD WIDTH="186" valign="top"> <BR> <CENTER><A HREF="index.html"><IMG SRC="homepage.jpg" alt="Homepage" border="0"></A></CENTER> <CENTER><A HREF="showroom.php"><IMG SRC="showroom.jpg" alt="Our Online Showroom" border="0"></A></CENTER> <CENTER><A HREF="location.html"><IMG SRC="ourlocation.jpg" alt="Our location" border="0"></A></CENTER> <CENTER><A HREF="aboutus.html"><IMG SRC="aboutus.jpg" alt="About Us" border="0"></A></CENTER> <CENTER><A HREF="contactus.php"><IMG SRC="contactus.jpg" alt="Contact Us" border="0"></A></CENTER> </TD> <TD WIDTH="30" valign="top"> </TD> <TD valign="top"> <FONT SIZE="2" FACE="ARIAL"> <CENTER><B>Add a Vehicle</B></CENTER> <BR> <form action="inserts.php" method="post"> <CENTER>Vehicle Name:</CENTER> <CENTER><input type="text" name="CarName"></CENTER> <br> <CENTER>Vehicle Type:</CENTER> <CENTER><input type="text" name="CarTitle"></CENTER> <br> <CENTER>Vehicle Price:</CENTER> <CENTER><input type="text" name="CarPrice"></CENTER> <br> <CENTER>Vehicle Mileage:</CENTER> <CENTER><input type="text" name="CarMiles"></CENTER> <br> <CENTER>Vehicle Description:</CENTER> <CENTER><textarea name="CarDescription" rows="10" cols="30"></textarea></CENTER> <br> <CENTER><input type="Submit"></CENTER> </form> </TD> </TR> </TABLE> <BR><BR><BR><BR> <CENTER><FONT FACE="VERDANA" SIZE="1"> This website was designed and is hosted by <A HREF="http://www.IRCDirect.co.uk">IRC Direct Website Design™</A> 2010 </CENTER> <BR> <CENTER><A HREF="admin.php">Employee Area</A> </BODY> </HTML> inserts.php (Actually handles adding info to the database thats been typed in form) <HTML> <HEAD> <TITLE>Barry Ottley Motor Co - Quality Used Motors - Stanford-Le-Hope, Essex</TITLE> </HEAD> <BODY LINK="#000000" ALINK="#000000" VLINK="#000000"> <CENTER><IMG SRC="logo.jpg"></CENTER> <CENTER> <TABLE WIDTH="840" CELLPADDING="0" CELLSPACING="0" BORDER="0"> <TR> <TD WIDTH="186" valign="top"> <BR> <CENTER><A HREF="index.html"><IMG SRC="homepage.jpg" alt="Homepage" border="0"></A></CENTER> <CENTER><A HREF="showroom.php"><IMG SRC="showroom.jpg" alt="Our Online Showroom" border="0"></A></CENTER> <CENTER><A HREF="location.html"><IMG SRC="ourlocation.jpg" alt="Our location" border="0"></A></CENTER> <CENTER><A HREF="aboutus.html"><IMG SRC="aboutus.jpg" alt="About Us" border="0"></A></CENTER> <CENTER><A HREF="contactus.php"><IMG SRC="contactus.jpg" alt="Contact Us" border="0"></A></CENTER> </TD> <TD WIDTH="30" valign="top"> </TD> <TD valign="top"> <FONT SIZE="2" FACE="ARIAL"> <CENTER><B>Vehicle Added</B></CENTER> <BR> <?php mysql_connect("localhost", "wormste1_barry", "barry") or die(mysql_error()); mysql_select_db("wormste1_barry") or die(mysql_error()); $CarName = mysql_real_escape_string(trim($_POST['CarName'])); $CarTitle = mysql_real_escape_string(trim($_POST['CarTitle'])); $CarPrice = mysql_real_escape_string(trim($_POST['CarPrice'])); $CarMiles = mysql_real_escape_string(trim($_POST['CarMiles'])); $CarDescription = mysql_real_escape_string(trim($_POST['CarDescription'])); mysql_query("INSERT INTO cars (CarName, CarTitle, CarPrice, CarMiles, CarDescription) VALUES('$CarName', '$CarTitle', '$CarPrice', '$CarMiles', '$CarDescription' ) ") or die(mysql_error()); echo "The vehicle data has been added!"; ?> </TD> </TR> </TABLE> <BR><BR><BR><BR> <CENTER><FONT FACE="VERDANA" SIZE="1"> This website was designed and is hosted by <A HREF="http://www.IRCDirect.co.uk">IRC Direct Website Design™</A> 2010 </CENTER> <BR> <CENTER><A HREF="admin.php">Employee Area</A> </BODY> </HTML> If anyone can help me... much appreciated. I googled it and it started quoting BLOBS and stuff... i was confused This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=357605.0 I'm having a really hard time getting my carousel to display in a line when I call my images from the table:
<div id="user-gallery"> <h2>Recent Images</h2> <button class="prev"><<</button> <button class="next">>></button> <?php include("file/image/upload_file.php"); $select_query = "SELECT `images_path` FROM `images_tbl` ORDER by `images_id` DESC LIMIT 9"; $sql = mysql_query($select_query) or die(mysql_error()); while($row = mysql_fetch_array($sql,MYSQL_BOTH)){ ?> <div class="anyClass"> <ul> <li><img src="<?php echo $row["images_path"]; ?>" alt="" width="125" height="70" ></li> <li><img src="<?php echo $row["images_path"]; ?>" alt="" width="125" height="70" ></li> <li><img src="<?php echo $row["images_path"]; ?>" alt="" width="125" height="70" ></li> <li><img src="<?php echo $row["images_path"]; ?>" alt="" width="125" height="70"></li> </ul> </div> <?php } ?> </div>Without the carousel it will display perfectly, but as soon as I implement it, the images won't behave normal :/ I am pretty new to PHP and am trying to create a simple (so I assumed) page to takes data from one html page(works fine) and updates a MYSQL Database. I am getting no error message, but the connect string down to the end of the body section is showing up as plain text in my browser window. I do not know how to correct this. I have tried using two different types of connect strings and have verified my names from the HTML page are the same as listed within the php page. Suggestions on what I need to look for to correct would be great. I have looked online, but so far all I am getting is how to connect, or how to create a comment, so I thought I would try here. Thank you for any assistance I may get!! - Amy - Code: [Select] <body><font color="006600"> <div style="background-color:#f9f9dd;"> <fieldset> <h1>Asset Entry Results</h1> <?php // create short variable names $tag=$_POST['tag']; $serial=$_POST['serial']; $category=$_POST['category']; $status=$_POST['status']; $branch=$_POST['branch']; $comments=$_POST['comments']; if (!$tag || !$serial || !$category || !$status || !$branch) { echo "You have not entered all the required details.<br />" ."Please go back and try again."; exit; } if (!get_magic_quotes_gpc()) { $tag = addslashes($tag); $serial = addslashes($serial); $category = addslashes($category); $status = addslashes($status); $branch = addslashes($branch); $comments = addslashes($comments); } //@ $db = new mysqli('localhost', 'id', 'pw', 'inventory'); $db = DBI->connect("dbi:mysql:inventory:localhost","id","pw") or die("couldnt connect to database"); $query = "insert into assets values ('".$serial."', '".$tag."', '".$branch."', '".$status."', '".$category."', '".$comments."')"; $result = $db->query($query); if ($result) { echo $db->affected_rows." asset inserted into Inventory."; } else { echo "An error has occurred. The item was not added."; } $db->close(); ?> </fieldset> </div> </body> This code is creating broken image.please check it png and gd is enabled. i also remove the header but still getting broken image. there is no space before/after php tags.thanks you my code Code: [Select] <?php // Set the content-type header('Content-Type: image/png'); // Create the image $im = imagecreatetruecolor(400, 30); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); // The text to draw $text = 'Testing...'; // Replace path by your own font path $font = 'arial.ttf'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); // Add the text imagettftext($im, 20, 0, 10, 20, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?> Okay I don't think I made myself clear last time. If this is too much hassle I will pay a small fee. But what I'm looking for is to be able to have a picture generated from my variables. I need 2 text inputs which put out the two lines shown. also need the background to gather from file directory. Also the biggest help i need is the text to be centered, since i keep messing that up PNG format = preferable. EXAMPLE - Thanks again. is there anway way of being able to paste a picture into a textarea? hi, i would like to no how people do this http://runelink.org/site/sc.php?server=TestScapez its an image with the name and votes of a server in a mysql database how would i do this? is this possible to get the text in an image? Hello. I would like to create a banner that gets two variables $one and $two. Then write them both onto my 468 by 60 image for examples sake "image.jpg" I know its something to do with imagettftext. However I can't find any good help around. Thanks Hello guys. Well I've ran into a sorta crossroad here with this script. See I'm trying to create like a click to make point system on an image. I have it all working except 1 problem.. At the moment the text to image script is only adding 1 bit of text onto the image, that is fine, that is because this is the only one in the php file: Code: [Select] Imagettftext($im, 12, 0, $X, $Y, $black, 'verdana.ttf', "$text"); But, what I am trying to do is to let the user create more points. I thought I could achieve this by a database and just echoing out all of the rows from point txt which are like the above. So it will be like Imagettftext($im, 12, 0, 342, 455 $black, 'verdana.ttf', "$text"); Imagettftext($im, 12, 0, 443, 953, $black, 'verdana.ttf', "$text"); Imagettftext($im, 12, 0, 553, 445, $black, 'verdana.ttf', "$text"); And every time a user adds another point another one of the above is added to the database, it is then read by the TXT file, and displayed onto the image. Although I only have this running at the moment: Code: [Select] <?php echo $row['pointtxt']; ?><br> And for a test I just tried a simple echo command, and this is the only record or row in the database in the field pointtxt: Code: [Select] echo "hello"; As you can image, I don't think an echo can echo PHP commands, sorry this is really hard to explain, if anyone needs further explaining tho I will try. Its basically I just want a user to add one of these into the database Imagettftext($im, 12, 0, 553, 445, $black, 'verdana.ttf', "$text"); And on the image, it will grab all of those from the database, and run them so they all appear on the image. Thanks for your help. |