PHP - To Display An Image File With No Name
I have uploaded a png image file to my server using FTP, the file is simply '.png' but displays the broken image icon
the image url is: http://www.instaworldcup.com/.png
how do i get this image to display with the name '.png' as I have seen on other sites, but i am having no luck
Similar TutorialsHello, Five images will be displayed inside a division. There will be a previous and next button/link. If someone click the next button the next image will be added in that div and the first image will be gone from that div. The previous button/link will do the same thing. Is it possible with php? I am confused if it's a javascript or ajax question. Thanks. Would like to be able to click on a radio button that represents an image. Once selected and submitted, have that image display on another page. I have an idea, but need some guidance. BTW, is using php only doable? Is there a simpler or more elegant way to do this? Thanks all! Hello: I have this code in an included file: myNav.php Code: [Select] function spLeftMenu() { $spLeftMenu = " <p> <div id=\"myLeftNavPaper\"> <img src=\"images/sidePaperTop.png\" alt=\"\" /> <div id=\"myLeftNavPaper2\"> echo \". $mySideBarPageData .\" </div> <img src=\"images/sidePaperBottom.png\" alt=\"\" /> </div> </p> "; return $spLeftMenu; } I can not get: Code: [Select] echo \". $mySideBarPageData .\" To display the results on this page: Page.php Code: [Select] <html> ... <?php echo spLeftMenu(); ?> ... </html> What am I missing ??
I am using an inclue file on my layout.php page. I have a program which have written with c+ +. This program is a generic server stats program for all Silkroad versions. ( Silkroad = MMORPG game like WoW ). " So if you have a website, you can upload the file via FTP to your own directory and write a simple PHP script or ASP script to parse the file and display the results. Or, you can post the data via PHP via a web URL. " I need to make this what i write that write the results. This write the following data: Code: [Select] Server Id Server Name Current Players Max Players State (1 = open, 0 = check) For example: 2 220 Zeus 354 2500 1 221 Venus 539 2500 1 And save this data to any.txt file. Here is the site: http://www.error-soft.net/forum/prvsro.php u need to se the server stats : Server Name Players State Status Total Capacity 2059 / 6000 [34%] ZSZC(Fire) 0 / 2000 Empty Offline ZSZC (Water) 2059 / 2000 Full Online ZSZC (Retro) 0 / 2000 Empty Offline i have the program what check the server and write this information to text file, but i do not know how can i parse this information like this website. Can I get some help or a point in the right direction.
I am trying to create a form that allows me to add, edit and delete records from a database.
I can add, edit and delete if I dont include the image upload code.
If I include the upload code I cant edit records without having to upload the the same image to make the record save to the database.
So I can tell I have got the code processing in the wrong way, thing is I cant seem to see or grasp the flow of this, to make the corrections I need it work.
Any help would be great!
Here is the form add.php code
<?php require_once ("dbconnection.php"); $id=""; $venue_name=""; $address=""; $city=""; $post_code=""; $country_code=""; $url=""; $email=""; $description=""; $img_url=""; $tags=""; if(isset($_GET['id'])){ $id = $_GET['id']; $sqlLoader="Select from venue where id=?"; $resLoader=$db->prepare($sqlLoader); $resLoader->execute(array($id)); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Add Venue Page</title> <link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <?php $sqladd="Select * from venue where id=?"; $resadd=$db->prepare($sqladd); $resadd->execute(array($id)); while($rowadd = $resadd->fetch(PDO::FETCH_ASSOC)){ $v_id=$rowadd['id']; $venue_name=$rowadd['venue_name']; $address=$rowadd['address']; $city=$rowadd['city']; $post_code=$rowadd['post_code']; $country_code=$rowadd['country_code']; $url=$rowadd['url']; $email=$rowadd['email']; $description=$rowadd['description']; $img_url=$rowadd['img_url']; $tags=$rowadd['tags']; } ?> <h1 class="edit-venue-title">Add Venue:</h1> <form role="form" enctype="multipart/form-data" method="post" name="formVenue" action="save.php"> <input type="hidden" name="id" value="<?php echo $id; ?>"/> <div class="form-group"> <input class="form-control" type="hidden" name="id" value="<?php echo $id; ?>"/> <p><strong>ID:</strong> <?php echo $id; ?></p> <strong>Venue Name: *</strong> <input class="form-control" type="text" name="venue_name" value="<?php echo $venue_name; ?>"/><br/> <br/> <strong>Address: *</strong> <input class="form-control" type="text" name="address" value="<?php echo $address; ?>"/><br/> <br/> <strong>City: *</strong> <input class="form-control" type="text" name="city" value="<?php echo $city; ?>"/><br/> <br/> <strong>Post Code: *</strong> <input class="form-control" type="text" name="post_code" value="<?php echo $post_code; ?>"/><br/> <br/> <strong>Country Code: *</strong> <input class="form-control" type="text" name="country_code" value="<?php echo $country_code; ?>"/><br/> <br/> <strong>URL: *</strong> <input class="form-control" type="text" name="url" value="<?php echo $url; ?>"/><br/> <br/> <strong>Email: *</strong> <input class="form-control" type="email" name="email" value="<?php echo $email; ?>"/><br/> <br/> <strong>Description: *</strong> <textarea class="form-control" type="text" name="description" rows ="7" value=""><?php echo $description; ?></textarea><br/> <br/> <strong>Image Upload: *</strong> <input class="form-control" type="file" name="image" value="<?php echo $img_url; ?>"/> <small>File sizes 300kb's and below 500px height and width.<br/><strong>Image is required or data will not save.</strong></small> <br/><br/> <strong>Tags: *</strong> <input class="form-control" type="text" name="tags" value="<?php echo $tags; ?>"/><small>comma seperated vales only, e.g. soul,hip-hop,reggae</small><br/> <br/> <p>* Required</p> <br/> <input class="btn btn-primary" type="submit" name="submit" value="Save"> </div> </form> </div> </body> </html>Here is the save.php code <?php error_reporting(E_ALL); ini_set("display_errors", 1); include ("dbconnection.php"); $venue_name=$_POST['venue_name']; $address=$_POST['address']; $city=$_POST['city']; $post_code=$_POST['post_code']; $country_code=$_POST['country_code']; $url=$_POST['url']; $email=$_POST['email']; $description=$_POST['description']; $tags=$_POST['tags']; $id=$_POST['id']; if(is_uploaded_file($_FILES['image']['tmp_name'])){ $folder = "images/hs-venues/"; $file = basename( $_FILES['image']['name']); $full_path = $folder.$file; if(move_uploaded_file($_FILES['image']['tmp_name'], $full_path)) { //echo "succesful upload, we have an image!"; var_dump($_POST); if($id==null){ $sql="INSERT INTO venue(venue_name,address,city,post_code,country_code,url,email,description,img_url,tags)values(:venue_name,:address,:city,:post_code,:country_code,:url,:email,:description,:img_url,:tags)"; $qry=$db->prepare($sql); $qry->execute(array(':venue_name'=>$venue_name,':address'=>$address,':city'=>$city,':post_code'=>$post_code,':country_code'=>$country_code,':url'=>$url,':email'=>$email,':description'=>$description,':img_url'=>$full_path,':tags'=>$tags)); }else{ $sql="UPDATE venue SET venue_name=?, address=?, city=?, post_code=?, country_code=?, url=?, email=?, description=?, img_url=?, tags=? where id=?"; $qry=$db->prepare($sql); $qry->execute(array($venue_name, $address, $city, $post_code, $country_code, $url, $email, $description, $full_path, $tags, $id)); } if($success){ var_dump($_POST); echo "<script language='javascript' type='text/javascript'>alert('Successfully Saved!')</script>"; echo "<script language='javascript' type='text/javascript'>window.open('index.php','_self')</script>"; } else{ var_dump($_POST); echo "<script language='javascript' type='text/javascript'>alert('Successfully Saved!')</script>"; echo "<script language='javascript' type='text/javascript'>window.open('index.php','_self')</script>"; } } //if uploaded else{ var_dump($_POST); echo "<script language='javascript' type='text/javascript'>alert('Upload Recieved but Processed Failed!')</script>"; echo "<script language='javascript' type='text/javascript'>window.open('index.php','_self')</script>"; } } //move uploaded else{ var_dump($_POST); echo "<script language='javascript' type='text/javascript'>alert('Successfully Updated.')</script>"; echo "<script language='javascript' type='text/javascript'>window.open('index.php','_self')</script>"; } ?>Thanks in advance! Edited by hankmoody, 12 August 2014 - 05:15 PM. Hi,
I've got a "data.txt" file with the following content:
One1:One2:One3:One4:One5:One6 Two1:Two2:Two3:Two4:Two5:Two6 Three1:Three2:Three3:Three4:Three5:Three6Now I want to be able to take each data and put on a specific location of a htlm code. Each line for its own. So for the first line, it should look something like this: <html> <head> <title></title> <head> <body> <h1>One2</h1> <h2>One4 some other Text One5</h2> <img src="One6.jpg"> </body> </html>Unforturtunately I don't have a clue how to do that. Can anybody help me out or does someone know a good and easy tutorial? Thanks a lot Hi all I need some help, i have a list of orders on the left column and want to click on each order and display related db information in the right column in a div or other method for each record click. screenshot attached.
I have a Php application that already has 2 buttons with input on the index page that perform some functions and output to different Php pages. Works good. How do I add a button with no input that would just perform a function and then just display a popup window showing the contents of a text file? I want to add several of these buttons for different functions and just display the contents of the resulting text files in popup windows. Any help would be greatly appreciated. Thanks in advance. Hey there, my problem is that I am trying to pull three images from a database and then displaying them with a large image above them. I want to then be able to click the smaller ones and then they become the larger one(kind of like on amazon). I am having 2 major problems with it at this point. the first is my while statement is only pulling 2 of the three images from the database, and secondly my image replacement javascript replaces with the smaller image. With the javascript it dosen't have to be done that way or in javascript so a link or suggestions on how to do that better would be great. So here's my code: <?php include('../../php/includes/openDbConn.php'); $sku = 'c-111111'; $getImages = "SELECT * FROM Images WHERE SKU = '".$sku."'"; $resultGetImages = mysql_query($getImages); $records = mysql_fetch_assoc($resultGetImages); ?> <img src="../../<?php echo $records['Path'] ?>" id="placeholder" alt="<?php echo $record['Description']; ?>" height="<?php echo $record['Width']; ?>" /> <div id="thumbImages"> <?php while($records = mysql_fetch_assoc($resultGetImages)){ echo "<a onclick=\"document.getElementById('placeholder').src='../../".$records['ThumbPath']."'\" target=\"_blank\"><img src=\"../../".$records['ThumbPath']."\" alt=\"".$records['Description']."\" height=\"".$records['ThumbWidth']."\" /></a>\n"; } ?> and a bit on the table with the images. It stores the sku and the Path of a thumbnail, regular and large sized image. All help is much appreciated. I have a script that uploads my images to a folder and database which works fine. I am looking to display my images on the fly to resize them. How do I intergrate my image output string with the fly string. Current output Code: [Select] echo '<img src="' . $dir . '/' . $image_id . '.jpg">'; Fly string Code: [Select] <img src="/scripts/thumb.php?src=/images/whatever.jpg&h=150&w=150&zc=1" alt="" /> Thanks for your help Hi im wanting to create this system where it loads all your files in a specified directory, loads all the images, although i have done that what im trying to do is have it so it prints them into a 9x9 grid automatically, in which i need to find something to restrain the echo of the variable to a limit of 9.. i need to create the <tr><th>and <td>'s automatically and also id like it so if there is more than 9, it will allow me to select a button which will load up the next section of images. heres the code i have so far: <?php $dir = "images/"; $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { $files[] = $filename; } sort($files); print_r($files); I then used this to try and echo into a table :S <?php if ($handle = opendir('images/')) { while (false !== ($file = readdir($handle))) { echo "<table width='450px' height'450px' border='4px solid #000'>"; if ($file != "." && $file != ".."){ echo "<tr><td>$file<br></td>"; echo "<td><img src=images/".$file." height='20px' width='20px'></td></tr><br>"; } } echo "</table>"; closedir($handle); } ?> They are seperate as i havent merged together as i wud like to get them working first. I was trying to do the max and min on the array numbers but was stuck doing that. Any help would be greatly apprecated Many thanks Lewis Stevens Don't know if it is php or html but the image won't display. Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" > <head> <meta name="google-site-verification" content="y_kspZkCZOQM-WGNB_lQ8BhJS8p7-B66hkHI_UhzKbs" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-language" content="en" /> <link type="text/css" rel="stylesheet" href="css/reset.css" /> <link type="text/css" rel="stylesheet" href="css/960.css" /> <link type="text/css" rel="stylesheet" href="css/custom.css" /> <title>Bay Area Remote Control Society</title> </head> <body> <div id="wrapper" class="container_12"> <div id="header" class="grid_12"> <div id="left-header" class="grid_5 alpha"><?php include('content/left-header.php'); ?></div> <div id="newsflash" class="grid_7 omega"><?php include('content/newsflash.php'); ?></div> </div> <div id="leftmenu" class="grid_3"><?php include('content/menu2.php'); ?></div> <div id="maincontent" class="grid_9"><?php include('content/maincontent.php'); ?></div> <div id ="footer" class="grid_12"><?php include('content/footer.php'); ?></div> </div><!-- end wrapper --> </body> </html> left-header.php Code: [Select] <?php ?> <img src="Pictures_Other/concorde.jpg" alt="concorde" border="0" width="250" height="188" /> Hey there I am having a problem where I am pulling the records for images from my database and then trying to display them. What happens is there are three images in the database and I want to display them. My code displays the images but it only shows two of the three. I know there are three images in the database I put them in and checked just to make sure. It just seems to only want to display two images instead of three. Here's the code:$getImages = "SELECT * FROM Images WHERE SKU = '".$sku."'"; $resultGetImages = mysql_query($getImages); $records = mysql_fetch_assoc($resultGetImages); ?> while($records = mysql_fetch_assoc($resultGetImages)){ echo "<a onclick=\"document.getElementById('placeholder').src='../../".$records['Path']."'\" target=\"_blank\"><img src=\"../../".$records['ThumbPath']."\" alt=\"".$records['Description']."\" height=\"".$records['ThumbWidth']."\" /></a>\n"; } ?> I have tried a for loop as well but it displayed more images than were in the database and just a single image over and over again. I know that was a flaw in my code and I'm not even sure a for loop would even be a reasonable way to go. Hi, Im trying to get an image to display from a reference in the database but am having no joy. At the minute Im just playing about with PHP to get familiar with it so you can ignore most of the code. The line im interested in is: <td><?php echo "<img src=\"C:\wamp\www\fermpix\Pics\'{$row["Name"]}'\">";?></td> When I view the page in my browser I see the attached. Can anybody see what im doing wrong? Heres the full page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Browse Upload Files</title> </head> <body bgcolor="white"> <?php error_reporting(E_ALL); include 'db.inc'; $query = "SELECT ID, Name, Path, Date, Description FROM Pics"; if (!($connection = @ mysql_pconnect($hostName, $username, $password))) showerror(); if (!mysql_select_db("fermpics", $connection)) showerror(); if (!($result = @ mysql_query ($query, $connection))) showerror(); ?> <h1>Image database</h1> <h3>Click <a href="insert.php">here</a> to upload an image.</h3> <?php //require 'disclaimer'; if ($row = @ mysql_fetch_array($result)) { ?> <table> <col span="1" align="right"> <tr> <th>File Name</th> <th>Date</th> <th>Image</th> </tr> <?php do { ?> <tr> <td><?php echo "{$row["Name"]}";?></td> <td><?php echo "{$row["Date"]}";?></td> <td><?php echo "<img src=\"C:\wamp\www\fermpix\Pics\'{$row["Name"]}'\">";?></td> </tr> <?php } while ($row = @ mysql_fetch_array($result)); ?> </table> <?php } // if mysql_fetch_array() else echo "<h3>There are no images to display</h3>\n"; ?> </body> </html> I would appreciate any help. Cheers Paul I have the code below displaying images and image names. I want these to display in a table 2 rows high by the needed number of columns to show all the images in the directory. I have no idea what to do. What I am getting now is a single column with each image in its own row. <?php $path = "./uploaded/"; $dir_handle = @opendir($path) or die("Unable to open folder"); while (false != ($file = readdir($dir_handle))) { if($file == "index.php") continue; if($file == ".") continue; if($file == "..") continue; //show in a table 2 rows by required/needed number of columns echo'<div>'; echo '<table border="1">'; echo "<img src='$path/$file' alt='$file'>"."<img src='$file' alt='$file'>"; echo'</table>'; echo '<div>'; } ?> This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=332434.0 i am trying to display all the image from a dir and let the use lick on a image that takes them to other page where they can rename that image. or let them rename the image from the first page. here is what i have. Code: [Select] <?php SESSION_START(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="author" content="vs" /> <meta name="robots" content="index, follow" /> <title></title> </head> <body> <div id="centerColumn"> <div id="header"> </div> <p><span class="small"></span><br /> </p><br> <form method="post" action="data2file.php"> <?php echo ' <table> <tr><td>'; $username = $_SESSION['user']; $url = $username."./"; $handle = opendir ($url); while (false !== ($file = readdir($handle))) { if($file != "." && $file != ".." && $file != basename(__FILE__)) { //echo '<table border=1><tr><td>'; echo '<a href="edit.php" ><img border=1 src="'.$file.'"></a>'; echo '<br />'; echo "<input type=submit name=$file value=Edit>" ; print $file; echo '<br>'; echo "Enter new name: <input type='text' name='new-name' length='30'> <textarea type=text size='1' height='1'style='display:none' name='file-name' >". $file ."</textarea>"; echo '<hr>'; //echo '</td></tr></table>'; } } echo '</td>'; echo ' </table>'; ?> </body> </html> it works i loads all the images. and here is the data2file.php code Code: [Select] <?php SESSION_START(); echo $_POST['new-name']; echo '<br>'; echo $_POST['file-name']; echo '<br>'; echo "Successfully!"; ?> it's just display the name of the file and the new name i want to give it. But it only does the last image in the dir. How can i make the first code work so if the user clicks on the edit button it will pull only that image file name to the data2file.php and then from the data2file.php it will rename the file name. |