PHP - Displaying A Default Image
Hi all,
I have this script below where I am trying to display a default image if an image can not be found. For some reason though it is not working. <?php foreach (glob('./aircraft/' . $rowX['reg'] . '[0-8].jpg') as $file) { if (file_exists($file)) { echo "<img src=\"" . $file . "\" /><br />"; } else { echo "><img src=\"aircraft/wrightflyer.jpg\" /><br />";} } ?> Similar TutorialsHi All, Need help. I'm strugling to figure out how to write the code to display default image if no image is available. I'm able to display image if data is available. Not able figure how to echo if/else statment. Below is the code Code: [Select] <?php function perDetails($var1, $result, $var2){ $dft_img = 'lib/images/name.png'; echo '<div class="desc">'.$var1.'</div>'; $color="1"; echo '<table align="center" cellpadding="2" cellspacing="1">'; while($row = mysql_fetch_array($result)){ $id = $row['pid']; $name = $row['pname']; $img = $row['pphoto_localurl']; $poster = str_replace("./", "lib/", $img); if($color==1){ echo '<tr bgcolor="#FFC600"><td><img src="'.$poster.'" width="32" height="42" alt="'.$name.'"</td><td><a href="persons.php?det='.$var2.'&perid='.$id.'"> '.$name.'" </a></td></tr>'; $color="2"; } else { echo '<tr bgcolor="#C6FF00"><td><img src="'.$poster.'" width="32" height="42" alt="'.$name.'"</td><td><a href="persons.php?det='.$var2.'&perid='.$id.'"> '.$name.'" </a></td></tr>'; $color="1"; } } echo '</table>'; } ?> could someone help in how to resize a uploaded image size, say if someone is uploading a 1mb photo to my server, i wish for it to become 100kb and also resize its width and height? here is my code Code: [Select] //////////////////////////////////////uploader else if($action=="uploader") { echo "Upload your picture and copy the link <br/>after uploading to user it at gallery.<br/><br/>"; echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"index.php?action=uploaded&sid=$sid\">"; echo "Choose Pictu <br />"; echo "<input name=\"uploaded\" type=\"file\" /><br /><br />"; echo "<input type=\"submit\" value=\"Upload\" />"; echo "</form><br/>"; echo "<p align=\"center\">"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } //////////////////////////////////////uploader else if($action=="uploaded") { $blacklist = array(".php", ".php.jpg", ".php.jpeg", ".php.gif", ".php.png", ".phtml", ".php3", ".php4"); foreach ($blacklist as $item) { if(preg_match("/$item\$/i", $_FILES['uploaded']['name'])) { echo "<p align=\"center\">"; echo "Oops sorry we do not allow those files.<br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; exit; } } $target = "../images/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if (file_exists("../images/" . $_FILES["uploaded"]["name"])) { echo "<p align=\"center\">"; echo $_FILES["file"]["name"] . "Oops file name already exists<br/> kindly rename your picture and upload again. <br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; }else{ //This is our size condition if ($uploaded_size > 25600){ echo "Your file is too large. We have a 25kb limit.<br/>"; $ok=0; } $types = array('image/jpeg', 'image/gif', 'image/png'); if (in_array($_FILES['uploaded']['type'], $types)) { // file is okay continue } else { $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0){ echo "<p align=\"center\">"; Echo "Sorry your file was not uploaded.<br/> It may be the wrong filetype. <br/>We only allow JPG, GIF, and PNG filetypes.<br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } //If everything is ok we try to upload it else{ if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)){ echo "<p align=\"center\">"; echo "The file ". basename( $_FILES['uploadedfile']['name']). " Picture uploaded successfully.<br/><br/><b>$target <br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } else{ echo "<p align=\"center\">"; echo "Sorry, there was a problem uploading your file.<br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>"; echo "</p>"; } } } } I am using this code Code: [Select] <?php echo IMAGES_HEADER . "header_02.jpg"; ?> Instead of displaying the actual image on my site I am getting the path of the image. It is displaying "images/header/header_02.jpg" instead. Thank You in advance i have a db which store jpg image thru the upload prg code in php.But the image is not displayed properly in the <img> and also when i echo the blob data. how to correct this code.i am pasting the code below $result = mysql_query("select cover from Movies where movie_id=4"); $row = mysql_fetch_row($result); $data = base64_decode($row[0]); $im = imagecreatefromstring($row[0]); imagejpeg($im); header('Content-type: ' . $mime); // 'image/jpeg' for JPEG images echo $data; <img src=<?php echo $data;?>> Hi everyone, Sorry not sure if this is a php or html problem. Im using php and a html form to upload images to my site, i have made it so that jpg, jpeg, gif and png images can be uploaded. The problem im having is displaying the image. Code: [Select] <img src="images/<?php echo $name ?>.jpg" /> That works fine if a jpg was uploaded, but what if a png or a gif was uploaded? The $name is going to be unique, there will not be more than one image with the same name, so what do i have to do to display the image regardless of what the extension is? Thanks I must be doing something incredibly daft, because I'm incredibly new at this. I have an image stored in a DB under a table called 'images' and I want to display it on my website but instead of that image I get the error: Warning: Cannot modify header information - headers already sent by (output started at /home/... This is how I'm trying to achieve it. Any ideas where I'm doing wrong? Thanks. Code: [Select] <?php $user="###"; $password="###"; $database="###"; $con = mysql_connect(localhost,$user,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database, $con); ?> <!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"> <head> <title>MySite</title> </head> <body> <div id="container"> <?php include("../navbar.php"); ?> <div id="left-content"></div> <div id="right-content"> <?php $item = $_GET['item']; $query = "SELECT * FROM main WHERE Ref='$item'"; $result = mysql_query($query) or die("Oops" .mysql_error()); $row = mysql_fetch_array($result,MYSQL_BOTH) or die("Oops" .mysql_error()); extract($row); $query2 = "SELECT image FROM main WHERE Ref='$item'"; // the result of the query $result2 = mysql_query($query2) or die("Invalid query: " . mysql_error()); header("Content-type: image/jpg"); echo mysql_result($result2, 0,'image'); echo "<p><strong>Name: </strong>".$FirstName." - ".$SecondName."</p>"; mysql_close($con); ?> </div> <br /> <?php include("../footer.php"); ?> </div> </div> </body> </html> MOD EDIT: [code] . . . [/code] BBCode tags added. Good day: Im trying to display an image from a folder and the image name is retrieved by a query. The query is getting the image name all right but the image is not displaying. This is the code im using for the image display Code: [Select] <?php $aid = 1; $connection = mysql_connect("localhost", "username", "password"); mysql_select_db("articles", $connection); $query="SELECT imagename, description FROM articles_description WHERE id='$aid'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); ?> <table width ="1000" border="1" cellspacing="2" cellpadding="2"> </tr> <?php $j=0; while ($j < $num) { $f8=mysql_result($result,$i,"description"); $f9=mysql_result($result,$i,"imagename") ?> <tr> <td valign="top"> <img src="images/'.$f9.'; ?>" alt="" name="picture" width="100" height="100" border="1" /></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f8; ?></font></td> </tr> <tr> </tr> <?php $j++; } ?> Any help will be appreciated I've taken this eg from php manual site for displaying txt on image wonder why it is not working Code: [Select] <?php // Create a 300x150 image $im = imagecreatetruecolor(300, 150); $black = imagecolorallocate($im, 0, 0, 0); $white = imagecolorallocate($im, 255, 255, 255); // Set the background to be white imagefilledrectangle($im, 0, 0, 299, 299, $white); // Path to our font file $font = './arial.ttf'; // First we create our bounding box for the first text $bbox = imagettfbbox(10, 45, $font, 'Powered by PHP ' . phpversion()); // This is our cordinates for X and Y $x = $bbox[0] + (imagesx($im) / 2) - ($bbox[4] / 2) - 25; $y = $bbox[1] + (imagesy($im) / 2) - ($bbox[5] / 2) - 5; // Write it imagettftext($im, 10, 45, $x, $y, $black, $font, 'Powered by PHP ' . phpversion()); // Create the next bounding box for the second text $bbox = imagettfbbox(10, 45, $font, 'and Zend Engine ' . zend_version()); // Set the cordinates so its next to the first text $x = $bbox[0] + (imagesx($im) / 2) - ($bbox[4] / 2) + 10; $y = $bbox[1] + (imagesy($im) / 2) - ($bbox[5] / 2) - 5; // Write it imagettftext($im, 10, 45, $x, $y, $black, $font, 'and Zend Engine ' . zend_version()); // Output to browser header('Content-Type: image/png'); imagepng($im); imagedestroy($im); ?> Hi guys, I have followed a tutorial and made a members only area using sessions. The user can upload an image and which gets renamed as their username. I was hoping to display all the users images that are logged in. I know how to do it with a single image by just setting the img src as the session username but I don't know how I would display multiple images if more than one person were logged in. Is it even possible? Hi, I am uploading an image to a folder and I need to display the uploaded image in a new page. This is my code for the upload: Code: [Select] <?php //define a maxim size for the uploaded images in Kb define ("MAX_SIZE","2000000"); //This function reads the extension of the file. It is used to determine if the // file is an image by checking the extension. function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } //This variable is used as a flag. The value is initialized with 0 (meaning no // error found) //and it will be changed to 1 if an errro occures. //If the error occures the file will not be uploaded. $errors=0; //checks if the form has been submitted if(isset($_POST['upload'])) { //reads the name of the file the user submitted for uploading $image=$_FILES['image']['name']; //if it is not empty if ($image) { //get the original name of the file from the clients machine $filename = stripslashes($_FILES['image']['name']); //get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); //if it is not a known extension, we will suppose it is an error and // will not upload the file, //otherwise we will do more tests if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { //print error message echo '<h1>Tipo de imagen no permitido.</h1>'; $errors=1; } else { //get the size of the image in bytes //$_FILES['image']['tmp_name'] is the temporary filename of the file //in which the uploaded file was stored on the server $size=filesize($_FILES['image']['tmp_name']); //compare the size with the maxim size we defined and print error if bigger if ($size > MAX_SIZE*1024) { echo '<h1>La imagen es demasiado grande.</h1>'; $errors=1; } //we will give an unique name, for example the time in unix time format $image_name=time().'.'.$extension; //the new name will be containing the full path where will be stored (images //folder) $newname="banners/".$image_name; //we verify if the image has been uploaded, and print error instead $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Error al subir la imagen.</h1>'; $errors=1; }}} //If no errors registred, print the success message if(isset($_POST['Submit']) && !$errors) { echo "<h1>La imagen se ha cargado correctamente</h1>"; } $query = "INSERT INTO banner_rotator.t_banners (banner_path) ". "VALUES ('$newname')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); //echo "<br>Files uploaded<br>"; header("Location: PC_cropbanner.php"); }Sowhat I need to do is to display the uploaded image in PC_cropbanner.php. How can I do this? 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 Hi everyone, i am just trying to learn php for a bit of fun really and started making a sort of 'facebook' website. I am having trouble however trying to display different users images, for example when trying to find a correct 'friend' only the image of the last result is being shown for all people with the same name... here is my code below, if anyone can help me out that would be great file 1 $count=1; while ($numids>=$count){ echo "<form method=\"post\" action=\"friendadded.php\">"; $frienduserid=$_SESSION["passedid[$ii]"]; $friendfirstname=$_SESSION["passedfirstname[$ff]"]; $friendlastname=$_SESSION["passedlastname[$ll]"]; $_SESSION['friendsuserpicid'] = $frienduserid; echo "<table width=\"700\" height=\"50\" border=\"1\" align=\"center\">"; echo "<tr>"; echo "<th></th>"; echo "<th>First Name</th>"; echo "<th>Last Name</th>"; echo "</tr>"; echo "<tr>"; echo "<td><center>"; echo "<img border=\'0\' src=\"frienduserpic.php\" width=\"80\" height=\"80\" align=\"middle\"/>"; echo "</center></td>"; echo "<td><center>"; echo $friendfirstname; echo "</center></td>"; echo "<td><center>"; echo $friendlastname; echo "</center></td>"; echo "</tr>"; echo "</table>"; echo "<center><input type=\"submit\" value=\"Add this friend\" name=\"Add Friend\"></center><br/>"; $ii=$ii+1; $ff=$ff+1; $ll=$ll+1; $count=$count+1; echo "</form>"; } file 2 session_start(); $passeduserid=$_SESSION['friendsuserpicid']; $timespost=$_SESSION['postednum']; $host= $username= $password= $db_name= $tbl_name= mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $query = mysql_query("SELECT * FROM $tbl_name WHERE picid='".$passeduserid."'"); $row = mysql_fetch_array($query); $content = $row['image']; header("Content-type: image/jpeg"); echo $content; Thanks in advance Now I am trying to display the images from my table and I have almost got it working, except for one small thing --- it seems to be displaying all the records, but instead of displaying the right image for each record, it's displaying the same image across all the records. Can anyone tell me what I have done wrong? Code: [Select] this is the gallery <?php $dbhost = 'localhost'; $dbuser = 'webdes17_lizkula'; $dbpass = 'minimoon'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'webdes17_jewelry'; mysql_select_db($dbname); $all_records = "SELECT * FROM gallery"; $all_records_res = mysql_query($all_records); $image = mysql_result($all_records_res, 0, 'image'); while($nt=mysql_fetch_array($all_records_res)){ echo "<img src=http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/$image>"; } ?> I'm guessing I have the $image variable in the wrong place, but when I tried placing it within the while statement, the page never loaded, and instead acted like it was loading forever. What am I doing wrong? Here is the link to the page so you can see what is happening: http://webdesignsbyliz.com/wdbl_wordpress/test-submit/ I just can't get anything right today! Now I am trying to have a list of images, and when the user clicks on the image, the next page will display the image along with other fields for that record. I am sending the id through the hyperlink to the next page, and I have echoed it to ensure it's comign through, but I cannot get anythign to display ont he next page. What am I doin wrong? Here is the link to the page. If you click on one of the images, you 'll see that the next page is empty: http://webdesignsbyliz.com/wdbl_wordpress/test-submit/ Here is my code: Code: [Select] this is the gallery <?php $dbhost = 'localhost'; $dbuser = 'user'; $dbpass = 'pass'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'jewelry'; mysql_select_db($dbname); $all_records = "SELECT * FROM gallery"; $all_records_res = mysql_query($all_records); $image = mysql_result($all_records_res, 0, 'image'); $id = mysql_result($all_records_res, 0, 'id'); while($nt=mysql_fetch_array($all_records_res)){ echo "<a href=http://webdesignsbyliz.com/wdbl_wordpress/test-display/?id=" .$nt['id']." ><img src=http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/".$nt['image']." width=133 height=86></a>"; } ?> display page: Code: [Select] <?php $id = $_GET['id']; $dbhost = 'localhost'; $dbuser = 'user'; $dbpass = 'pass'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'jewelry'; mysql_select_db($dbname); $all_records = "SELECT * FROM gallery WHERE id = $_GET[id]"; $all_records_res = mysql_query($all_records); $image = mysql_result($all_records_res, 0, 'image'); $id = mysql_result($all_records_res, 0, 'id'); while($nt=mysql_fetch_array($all_records_res)){ echo "<img src=http://www.webdesignsbyliz.com/wdbl_wordpress/wp-content/themes/twentyten_2/upload/".$nt['image']." width=133 height=86></a>"; } ?> What an I doing wrong this time?? :-( Hi I'm trying to create a page where there is a grid of images and if you click on one of those images it will expand. Once the image has expanded and you click on the i icon that is below it, the i icon will display the information about that image. This isn't like a popup or anything like that, because when you click on the image and it expands, it expands in the same spot and it doesn't popup. Here is the html $str.='<div class="portfolio-banner-wrapper'.$langClass.'" style="position: relative;">'; $str.= '<a class="portfolio-arrow-left'.$langClass.' portfolio-navigate'.$langClass.'" href="javascript:void(0);"><img src="images/left-arrow.png" onmouseover="this.src=\'images/blue-left-arrow.png\'" onmouseout="this.src=\'images/left-arrow.png\'" /></a>'; $str.= '<a class="portfolio-arrow-right'.$langClass.' portfolio-navigate'.$langClass.'" href="javascript:void(0);"><img src="images/right-arrow.png" onmouseover="this.src=\'images/blue-right-arrow.png\'" onmouseout="this.src=\'images/right-arrow.png\'"/></a>'; $str.= '<div class="portfolio-banner-inner">'; $str.= $this->getPortfolioTest(); $str.= '</div>'; $str.='</div>'; $str.='<div class="overlay-bg'.$langClass.'">'; $str.= '<div class="additional-navigation-wrapper'.$langClass.'">'; $str.= '<div class="info'.$langClass.'" style="display: none;">'; $str.= '<a class="border-bottom-white padding-level-one inactive additional-nav-info1" href="javascript:void(0);">'; $str.= '<img class="icon" src="images/i_icon.png" />'; $str.= '<img class="nav-arrow no-action floatright" src="images/nav-arrow-white.png" />'; $str.= '<span class="clearboth"></span>'; $str.= '</a>'; $str.= '<div class="additional-nav-info-wrapper1">'; $str.= $this->i_icon(); $str.= '</div>'; $str.= '</div>'; $str.= '</div>';Here is the php function getPortfolioTest(){ global $_PRODUCTS_TABLE, $_HTTP_ADDRESS, $_PRODUCTS_IMAGES_DIR; $i=0; $cpt = 1; $str = ''; $whichCount = 1; $jobSearch=''; $query = mysql_query("SELECT * FROM $_PRODUCTS_TABLE WHERE `active`='1' AND `image` LIKE '%.%'".$jobSearch." ORDER BY `client` ASC"); $combineArr = mysql_num_rows($query); while( $result = mysql_fetch_object($query) ){ $product = new Product($result->id); $product->setFromDatabase(); $linkOut = getSEOLink($product->id); $target = ""; if(trim($product->linkout) != ""){ $linkOut = $product->linkout; $target = ' target="_blank"'; } if($whichCount == 1){ $portfolioClass="portfolio-active"; $style = "position: absolute; left:0%; top:0; width:100%;"; }else{ $portfolioClass="portfolio-inactive"; $style = "position: absolute; left:-100%; top:0; width:100%;"; } if($whichCount == 1){ $str.='<div id="portfolio-slide'.$i.'" class="portfolio-slide '.$portfolioClass.'" style="'.$style.'">'; $str.= '<div class="portfolio-slide-inner">'; $str.= '<div class="portfolio-banner-content portfolio-banner-left">'; $str.= '<div class="portfolio-banner-header">'; $str.= '</div>'; $str.= '<div class="portfolio-banner-copy">'; $str.= '<ul id="gallery">'; } $str.= '<li>'; $str.= '<a'.$target.' href="javascript:void(0);">'; $str.= '<img src="'.$_HTTP_ADDRESS.'products_images/'.$result->image.'">'; echo "this is getPortfolioTest"; $str.= '</a>'; $str.= '<span>'; $str.= '<h3>'.$result->name.'</h3>'; $str.= $result->description; $str.= '</span>'; $str.= '</li>'; if($whichCount % 9 == 0 && $whichCount < $combineArr){ $i++; $str.= '<div class="clearboth"></div>'; $str.= '</ul>'; $str.= '</div>'; $str.= '</div>'; $str.= '</div>'; $str.='</div>'; $str.='<div id="portfolio-slide'.$i.'" class="portfolio-slide '.$portfolioClass.'" style="'.$style.'">'; $str.= '<div class="portfolio-slide-inner">'; $str.= '<div class="portfolio-banner-content portfolio-banner-left">'; $str.= '<div class="portfolio-banner-header">'; $str.= '</div>'; $str.= '<div class="portfolio-banner-copy">'; $str.= '<ul id="gallery">'; } if($whichCount == $combineArr){ $str.= '<div class="clearboth"></div>'; $str.= '</ul>'; $str.= '</div>'; $str.= '</div>'; $str.= '</div>'; $str.='</div>'; } $whichCount++; $cpt++; } return $str; } function i_icon(){ global $_PRODUCTS_TABLE, $_HTTP_ADDRESS, $_PRODUCTS_IMAGES_DIR; $str = ''; $i = 0; $query = mysql_query("SELECT * FROM $_PRODUCTS_TABLE WHERE `active`='1'"); while($result = mysql_fetch_object($query)){ $str.= '<div class="additional-nav-info-inner'.$i.' overlay-bg" style="display:none;">'; $str.= '<ul>'; $str.= '<h3>'.$result->name.'</h3>'; $str.= '<p>'; $str.= $result->overview; $str.= '</p>'; $str.= '</ul>'; $str.= '</div>'; $i++; } return $str; }Here is the Jquery function galleryInit(){ $('#gallery li').hover( function(){$('span',this).slideToggle('fast');}, function(){$('span',this).slideToggle('fast'); }); $(".portfolio-banner-inner li").click(function(e){ if($(".activeExpand").length > 0){ $(".portfolio-active").css({"left":"0%"}); $(".portfolio-active").prevAll().css({"left":"-100%"}); $(".portfolio-active").nextAll().css({"left":"100%"}); $(".portfolio-banner-inner li").removeClass("inactiveExpand").removeClass("activeExpand").removeAttr("style").find("img").removeAttr("style"); $(".portfolio-arrow-left-scroll").addClass("portfolio-arrow-left").removeClass("portfolio-arrow-left-scroll"); $(".portfolio-arrow-right-scroll").addClass("portfolio-arrow-right").removeClass("portfolio-arrow-right-scroll"); return false; } $this = $(this); $(".portfolio-banner-inner li").addClass("inactiveExpand") $this.removeClass("inactiveExpand").addClass("activeExpand"); $(".portfolio-slide").css({"left":"0"}) $this.parents(".portfolio-slide:first").prevAll().find(".portfolio-slide-inner li").css({"position":"absolute","width":"100%","height":"100%","top":"0","left":"-100%"}).find("img").css({"width":"952px","height":"502px"}); $this.parents(".portfolio-slide:first").nextAll().find(".portfolio-slide-inner li").css({"position":"absolute","width":"100%","height":"100%","top":"0","left":"100%"}).find("img").css({"width":"952px","height":"502px"}); $this.siblings().prevAll().css({"position":"absolute","width":"100%","height":"100%","top":"0","left":"-100%"}).find("img").css({"width":"952px","height":"502px"}); $this.siblings().nextAll().css({"position":"absolute","width":"100%","height":"100%","top":"0","left":"100%"}).find("img").css({"width":"952px","height":"502px"}); $this.css({"position":"absolute","width":"100%","height":"100%","top":"0","left":"0"}); $this.find("img").animate({ width: '952px',//what the width of the image to be expanded is height: '502px'//what the width of the image to be expanded is }, 200); $(".portfolio-arrow-left").addClass("portfolio-arrow-left-scroll").removeClass("portfolio-arrow-left"); $(".portfolio-arrow-right").addClass("portfolio-arrow-right-scroll").removeClass("portfolio-arrow-right"); }); } function imageSlider(direction){ $activeExpandWhere = $(".activeExpand"); if($(".activeExpand").css("left") != "0px") return false; if(direction == "right"){ $(".inactiveExpand").css({"left":"100%"}); $(".activeExpand").animate({"left":-100+"%"},500,"easeInCubic",function(){ $(this).removeClass("activeExpand").addClass("inactiveExpand"); }); if($(".activeExpand").next("li").length == 0){ if($activeExpandWhere.parents(".portfolio-slide:first").next().length == 0){ $(".portfolio-slide").removeClass("portfolio-active").addClass("portfolio-inactive"); $(".portfolio-slide:first").removeClass("portfolio-inactive").addClass("portfolio-active"); $(".portfolio-slide:first").find(".portfolio-slide-inner li").eq(0).animate({"left":0+"%"},500,"easeInCubic",function(){ $(this).removeClass("inactiveExpand").addClass("activeExpand"); }); return false; } $(".portfolio-slide").removeClass("portfolio-active").addClass("portfolio-inactive"); $activeExpandWhere.parents(".portfolio-slide:first").next().removeClass("portfolio-inactive").addClass("portfolio-active"); $activeExpandWhere.parents(".portfolio-slide:first").next().find(".portfolio-slide-inner li").eq(0).animate({"left":0+"%"},500,"easeInCubic",function(){ $(this).removeClass("inactiveExpand").addClass("activeExpand"); }); return false; } $(".activeExpand").next("li").animate({"left":0+"%"},500,"easeInCubic",function(){ $(this).removeClass("inactiveExpand").addClass("activeExpand"); }); return false; } $(".inactiveExpand").css({"left":"-100%"}); $(".activeExpand").animate({"left":100+"%"},500,"easeInCubic",function(){ $(this).removeClass("activeExpand").addClass("inactiveExpand"); }); if($(".activeExpand").prev("li").length == 0){ if($activeExpandWhere.parents(".portfolio-slide:first").prev().length == 0){ $(".portfolio-slide").removeClass("portfolio-active").addClass("portfolio-inactive"); $(".portfolio-slide:last").removeClass("portfolio-inactive").addClass("portfolio-active"); $(".portfolio-slide:last").find(".portfolio-slide-inner li").eq(($(".portfolio-slide:last").find(".portfolio-slide-inner li").length-1)).animate({"left":0+"%"},500,"easeInCubic",function(){ $(this).removeClass("inactiveExpand").addClass("activeExpand"); }); return false; } $(".portfolio-slide").removeClass("portfolio-active").addClass("portfolio-inactive"); $activeExpandWhere.parents(".portfolio-slide:first").prev().removeClass("portfolio-inactive").addClass("portfolio-active"); $activeExpandWhere.parents(".portfolio-slide:first").prev().find(".portfolio-slide-inner li").eq(0).animate({"left":0+"%"},500,"easeInCubic",function(){ $(this).removeClass("inactiveExpand").addClass("activeExpand"); }); return false; } $(".activeExpand").prev("li").animate({"left":0+"%"},500,"easeInCubic",function(){ $(this).removeClass("inactiveExpand").addClass("activeExpand"); }); } $(document).ready(function(e) { galleryInit(); $(".additional-nav-info1").click(function(){ if($(".additional-nav-info-inner1").css("display") == "block"){ $(this).removeClass("active"); $(this).addClass("inactive"); $(".additional-nav-info-inner1").stop().slideToggle(250); } else { $(this).removeClass("inactive"); $(this).addClass("active"); $(".additional-nav-info-inner1").stop().slideToggle(250); } }); $(".additional-nav-info-inner1 a").hover(function(){ $(this).find("img").eq(0).fadeOut(250); $(this).find("img").eq(1).fadeIn(250); }, function(){ $(this).find("img").eq(0).fadeIn(250); $(this).find("img").eq(1).fadeOut(250); }); } i have an image uploader... that people can link directly to an image. But say for example that image gets deleted. When someone tries to link to it i want it to display a custom imagedeleted.jpg how can i do this? I'm beginning with simple codes to understand how things work and work my way up with what I need. My upload form looks like this: <form name="upload about" action="display.php" enctype="multipart/form-data" method="post"> Header: <input type="text" name="header" /> Body: <input type="text" name="body" /> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> Image: <input type="file" name="pic" /> <input type="submit" /> </form> And my display page is just as simple. <?php echo $_POST["header"]; ?> <?php echo $_POST["body"]; ?> <?php echo $_FILES['pic']['name']; ?> The problem is, whenever I submit the data, everything is fine, except the image does not display and just posts the filename of the image I uploaded. According to my research setting the enctype to multipart/formdata should display the image, but it does not. Can anyone tell me what's wrong? Hello guys, I'm trying to figure out how to display and image that is located in one table (profile) and make it correspond to a variable on another table (latest_post) to where you echo out the variable from the table(latest_post) and the image from table(profile) appears next to the post. any how here is my code: Code: [Select] <?php $query = mysql_fetch_array(mysql_query("SELECT person FROM latest_post AND avatar_img FROM profile WHERE id FROM latest_post = id FROM profile ")); echo $query['avatar_img']; ?> Also when echoing out the query I only get the name of the image and not the image this is most likely because my image is stored in a different folder right? Thanks in advance, your help is much appreciated since I'm barely a beginner at php and MySQL. the script succesfuly insert image to the database bt, i cant be able to display it on my pages, any help i will appreciate
Attached Files
saveimage.php 1.15KB
2 downloads
images_tbl.php 192bytes
3 downloads Hi, everyone. I am trying to put together a WordPress for a client and although I hate asking for help - I am at a total standstill! She wants date tabs on the left of each post (on the main homepage and then each post; NOT pages- obviously, since those aren't 'dated', per say...). Here is the function.php code I am using: Code: [Select] // custom date tab - creates two divs // first div pulls in a background png image named by date // and adds year dynamically. Placed via css to left of post as // a hanging tab. remove_action('genesis_before_post_content', 'genesis_post_info'); add_action('genesis_before_post_content', 'family_tree_post_info'); function family_tree_post_info() { if(is_page()) return; // don't do post-info on pages echo '<div class="post-date-wrap">'; echo '<div class="post-date post-date-background" style="background:url('; echo CHILD_URL;; echo '/images/date'; echo the_time('F'); echo '/'; echo the_time('M'); echo '.png) no-repeat 4px -3px">'; echo the_time('Y'); echo '</div>'; echo '</div>'; echo '<div class="post-info">'; genesis_post_comments_link(__('Leave a Comment', 'child'), __('1 Comment', 'child'), __('% Comments', 'child')); edit_post_link(__('(Edit)', 'child'), '', ''); // if logged in echo '</div>'; } This shouldn't matter [much] - but here is the style.css for the post-dat: Code: [Select] .post-date-wrap { width: 65px; height: 73px; } .content-sidebar .post-date-wrap { float: left; margin-top: -42px; margin-left: -107px; background: url(images/dates/bgd-left.png) no-repeat top left; } .content-sidebar-sidebar .post-date-wrap { float: left; margin-top: -42px; margin-left: -84px; background: url(images/dates/bgd-left.png) no-repeat top left; } .full-width-content .post-date-wrap { float: left; margin-top: -42px; margin-left: -89px; background: url(images/dates/bgd-left.png) no-repeat top left; } .sidebar-content .post-date-wrap { width: 65px; height: 73px; float: right; margin-top: -42px; margin-right: -89px; background: url(images/dates/bgd-right.png) no-repeat top left; } .sidebar-sidebar-content .post-date-wrap { width: 65px; height: 73px; float: right; margin-top: -42px; margin-right: -86px; background: url(images/dates/bgd-right.png) no-repeat top left; } .sidebar-content-sidebar .post-date-wrap, .sidebar-content-sidebar .post-date { visibility: collapse; height: 0; width: 0; } .post-date { width: 62px; height: 17px; display: inline; text-align: center; color: #4e260d; padding: 50px 0 0 5px; font-size: 9px; } .content-sidebar .post-date, .content-sidebar-sidebar .post-date, .full-width-content .post-date { float: left; } .sidebar-content .post-date, .sidebar-sidebar-content .post-date { float: right; } Here are two pictures: * I have one of these for every day; for each month - found in images/dates - thereafter organized by months (in written out for October, November; then 1.png; 2.png, etc. for each DAY of the month) This is how it is coming up right now; only the year (that really small lettering that says 2011): I need the images with the month & date to appear inside of that box/tab. I have been working on this for too long and cannot get it to go. My 'thing' is design, so I really hope you can all help me! I just can't get PHP down.. I am sure it is something so ridiculous that I cannot see. Thanks for your help!! - Nicole |