PHP - Displaying Only Thumbnail Images
hi all
I am finishing off the final touches to my PHP postcard script and want to be able to display thumb file types only I have found a script to resize the images but this creates larger ones so i want to be able to switch between the two. <?php // CHANGE PARAMETERS HERE BEGIN $senderName = " Holidays From Home "; // Eg.: John's Postcards $senderEmail = "holidaysfromhome@voluntary.awardspace.co.uk"; // Eg.: john@postcard.com // Change only if you have problems with urls $postcardURL = "http://".$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"]; // CHANGE PARAMETERS HERE END $result = 0; $msg = ""; $msg1 = ""; $pic = ""; function displayPhotos() //edit photos and change image sizes { global $pic; $columns = 5; $act = 0; $act1 = 0; $sel = 0; // Open the actual directory if($handle = opendir("thumbs")) { // Read all file from the actual directory while($file = readdir($handle)) { if(!is_dir($file)) { if(isset($pic[1])) { if($pic[1] == $act1){$sel = "checked";} else{$sel = "unchecked";} } if($act == 0){echo "<tr>";} echo "<td align='center'><img src='thumbs/$file' alt='postcard' BORDER =1 /><br/><input type='radio' name='selimg' value='$file,$act1' $sel/></td>"; //displays the images $act++; $act1++; if($act == $columns){$act = 0;echo "</tr>";} } } echo "</tr>"; } } ?> my thumbnail images all end in (_th.jpg) and my large files all end in (.jpg). I am really stuck any help would be much appreciated Similar TutorialsI have a form where you can enter a image url and it's title. It calls display.php which displays the image as well as the title. But I want the image to be displayed as a thumbnail of size 150X100. Do i have to store it in directory before I convert it and display? If so, can somebody tell me how to convert the image into a thumbnail? Here is my code: Code: [Select] <table align="center" bgcolor="silver"> <form action="display.php" method ="post"> <tr> <td align="center"><b><font color="#214754" size="3">Reg</font></b></td> </tr> <tr> <td> Title: </td> <td><input type="text" size ="40" name="registry_title1" /></td> </tr> <tr> <td> Image URL: </td> <td><input type="text" size ="40" name="registry_img1" /></td> </tr> <tr> <td> <input type="submit" name="submit" value="submit" /> </td> </tr> </form> </table> </div> here is the code for display.php Code: [Select] <? /* Get Registry details */ $registry_img1=$_POST['registry_img1']; $registry_title1=stripslashes($_POST['registry_title1']); ?> <html> <body> <table width='600' cellspacing='0' cellpadding='0' border='0' bgcolor='#ffffff' align='center'> <tr> <td style='padding-bottom:8px';><font style='font-size:18px;color:rgb(0, 0, 0);text-decoration:none'><a style='font-size:18px;color:rgb(0, 0, 0);text-decoration:none' href='#'><? echo ucfirst($url); ?> Registry</font></a></td> </tr> <tr> <td style='padding-bottom:10px;'> <a style='color:rgb(206, 0, 0);font-size:14px;font-weight:bold;line-height:18px;text-decoration:none' href='<? echo $registry_url1; ?>' target='_blank'><img style='padding-right:10px' border='0' align='left' alt='' src='<? echo $registry_img1; ?>'><? echo $registry_title1;?> </a> </td> </table> </body> </html> Hi all, I am creating a thumbnail from an uploaded image (in this case a company logo). The problem is that the thumbnail image is poor quality and not fit to display on the website! I have attached the uploaded image and then then generated thumbnail, so you can see how much it is degrading. I always want the thumb to be the same size, which is 129pxx44px. I have included the thumb generation part of my script below: // This is declared at the start of the script $tdir = "images/agencylogos/thumbs/"; $twidth = "129"; $theight = "44"; // This is the actual part of the script that does the resizing $simg = imagecreatefromjpeg($newname); $currwidth = imagesx($simg); $currheight = imagesy($simg); if ($currheight > $currwidth) { $zoom = $twidth / $currheight; $newheight = $theight; $newwidth = $currwidth * $zoom; } else { $zoom = $twidth / $currwidth; $newwidth = $twidth; $newheight = $currheight * $zoom; } $dimg = imagecreate($newwidth, $newheight); imagetruecolortopalette($simg, false, 256); $palsize = ImageColorsTotal($simg); imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight); // Copy Resized Image To The New Image (So We Can Save It) imagejpeg($dimg, "$tdir" . $image_name, 100); imagedestroy($simg); imagedestroy($dimg); Can anyone see any ways of improving this script so that it would make the thumb image better quality? Many thanks, Greens85 Upload images - Thumbnail sizes? Hi all I haven't used php for a while now and I'm really stuck on some code I wrote and now I can't work how to change it. I have this function to upload images and create thumbnails. The thumbnails can be either landscape or portrait and I want them to have the same height. At the moment the portrait thumbnails height is equal to the landscape thumbnail width. The dimensions of the thumbnails are the same but the portrait images are portrait. How can I size the thumbnails so they all have the same height. Thanks in advance for any help or advice on this. Code: [Select] function upload_images(){ $photo_types = array('image/pjpeg'=>'.jpeg','image/jpeg'=>'.jpg','image/gif'=>'.gif','image/.bmp'=>'bmp','image/x-png'=>'.png'); //$number_of_uploads = 5; $image_Dir = "images_1/"; $image_thumb_Dir = $image_Dir . "thumbs/"; $photo_id_arr = array(); $photo_ext_arr = array(); $photo_id_ext_arr = array(); // if(isset($_FILES['images'])){ $image_uploaded = $_FILES['images']; for($i=0; $i<=count($_FILES['images']['name']);$i++){ if(!empty($image_uploaded['name'][$i])){ if(array_key_exists($image_uploaded['type'][$i], $photo_types)){ $file_temp = mysql_prep($image_uploaded['name'][$i]); // $query = "INSERT INTO photos (filename) VALUES ('{$file_temp}')"; $result = mysql_query($query); confirm_query($result); if($result){ $photo_id = mysql_insert_id(); array_push($photo_id_arr, $photo_id); } // $filetype = $image_uploaded['type'][$i]; $ext = $photo_types[$filetype]; array_push($photo_ext_arr, $ext); $dbfile_name = $photo_id . $ext; // $query = "UPDATE photos SET filename = '{$dbfile_name}' WHERE photo_id = '{$photo_id}'"; $result = mysql_query($query); confirm_query($result); // // $stored_image = $image_Dir . $dbfile_name; $stored_thumb = $image_thumb_Dir . $dbfile_name; move_uploaded_file($image_uploaded['tmp_name'][$i], $stored_image ); // $src_image = imagecreatefromjpeg($stored_image); // $src_width = imagesx($src_image); $src_height = imagesy($src_image); $new_width = 900; $new_height = 900; // if($src_width > $src_height){ $img_w = $new_width; $img_h = $src_height*($new_height/$src_width); } if($src_width < $src_height){ $img_w = $src_width*($new_width/$src_height); $img_h = $new_height; } if($src_width == $src_height){ $img_w = $new_width; $img_h = $new_height; } // $mainImg = imagecreatetruecolor($img_w, $img_h); imagecopyresampled($mainImg, $src_image,0,0,0,0,$img_w, $img_h, $src_width, $src_height); imagejpeg($mainImg, $stored_image, 100); imagedestroy($src_image); imagedestroy($mainImg); //*************************** // // // //*************************** $src_image = imagecreatefromjpeg($stored_image); // $src_width = imagesx($src_image); $src_height = imagesy($src_image); $new_width = 85; $new_height = 85; // if($src_width > $src_height){ $thumb_w = $new_width; $thumb_h = $src_height*($new_height/$src_width); } if($src_width < $src_height){ $thumb_w = $src_width*($new_width/$src_height); $thumb_h = $new_height; } if($src_width == $src_height){ $thumb_w = $new_width; $thumb_h = $new_height; } // $thumb = imagecreatetruecolor($thumb_w, $thumb_h); imagecopyresampled($thumb, $src_image,0,0,0,0,$thumb_w, $thumb_h, $src_width, $src_height); imagejpeg($thumb, $stored_thumb, 100); imagedestroy($src_image); imagedestroy($thumb); }else{ //echo "File format not supported."; } } } array_push($photo_id_ext_arr, $photo_id_arr); array_push($photo_id_ext_arr, $photo_ext_arr); return $photo_id_ext_arr; } } Hello I am using this script right here http://www.nearby.org.uk/sphinx/search-example5-withcomments.phps and am trying to show images from my db but I can only get it to show the first image. Does anyone know how to make it show all images if images even exist for that particular search result? I changed the query to $CONF['mysql_query'] = ' SELECT l.link_id AS id, l.title AS title, l.fulltxt AS body, l.url AS url, m.media_id AS im_id, m.title AS im_title, m.thumb_link AS im_t_link FROM search1_links AS l LEFT JOIN search1_media AS m ON (m.link_id = l.link_id) WHERE l.link_id IN ($ids) '; and added if ($row['im_id']) { echo '<img src="'.($row['im_t_link']).'" height="100px" width="100px"> '; } right here //Actully display the Results print "<ol class=\"results\" start=\"".($currentOffset+1)."\">"; foreach ($ids as $c => $id) { $row = $rows[$id]; $link = htmlentities(str_replace('$id',$row['id'],$CONF['link_format'])); print "<li><a href=\"$link\">".htmlentities($row['title'])."</a><br/>"; if ($CONF['body'] == 'excerpt' && !empty($reply[$c])) print ($reply[$c])."</li>"; else if ($row['im_id']) { echo '<img src="'.($row['im_t_link']).'" height="100px" width="100px"> '; } print htmlentities($row['body'])."</li>"; } print "</ol>"; if ($numberOfPages > 1) { print "<p class='pages'>Page $currentPage of $numberOfPages. "; printf("Result %d..%d of %d. ",($currentOffset)+1,min(($currentOffset)+$CONF['page_size'],$resultCount),$resultCount); print pagesString($currentPage,$numberOfPages)."</p>"; } Can anyone help me to be able to display all images if they exist? Thanks. So I am trying to display an image from a database (I know it's not the best idea but it's what I was told to do). Anyway I'm having problems displaying it. Here is the code for displaying the image. $cat = $_GET['cat']; include 'includes/openDbConn.php'; $sql = 'SELECT * FROM CushionsCategories WHERE CushionCategory = "'.$cat.'"'; echo $sql; $result = mysql_query($sql); echo '<table>'; while($val = mysql_fetch_assoc($result)){ $cush = 'SELECT * FROM Cushion WHERE SKU = "'.$val['CushionSKU'].'"'; echo $cush; $cushres = mysql_query($cush); $cushval = mysql_fetch_assoc; $img = 'SELECT * FROM Images WHERE SKU = "'.$val['CushionSKU'].'"'; echo $img; $imgres = mysql_query($img); $imgval = mysql_fetch_assoc($imgres); if( $i % 3 == 0 ) { echo '</tr><tr>'; } echo '<td><img src="image.php?sku='.$val['CushionSKU'].'" name="'.$imgval['FileName'].'" description="'.$imgval['Description'].'" /></td>'; } echo '</tr></table>'; and the page that gets the image: $sql = 'SELECT Image FROM Images WHERE SKU = "'.$sku.'"'; //echo $sql; $result = mysql_query($sql) or die("Invalid query: " . mysql_error()); // set the header for the image header("Content-type: image/jpeg"); echo mysql_result($result, 0); Thanks for any help in advance. I had this page working fine where it retrieves a set of images from the database depending on what thumbnail was click on the previous page. Now I am trying to add an edit and delete button to each of the pictures and it will not display any of it now! This is the code I am using: Code: [Select] <?php $id = $_GET[id]; ?> <?php $max_items = 16; /* max number of news items to show */ require_once('config.php'); $db = mysql_connect (DB_HOST,DB_USER,DB_PASSWORD); if(!$db) { die('Failed to connect to server: ' . mysql_error()); } mysql_select_db (DB_DATABASE,$db); function displayNews($all = 0) { global $db, $max_items; if ($all2 == 0) { /* query for news up to $max_items */ $query13 = "SELECT image,id,description,projectcode,thumbnail " . "FROM project WHERE projectcode='$id' ORDER BY id DESC LIMIT $max_items"; } else { /* query for all news */ $query13 = "SELECT image,id,description,projectcode,thumbnail " . "FROM project WHERE projectcode='$id' ORDER BY id DESC"; } $result13 = mysql_query($query13) or print("<p>Error fetching entries from the database, error: " . "Statement: " . $query13 . "</p>" . mysql_error()); while ($row13 = mysql_fetch_array($result13)) { $title = htmlentities ($row13['description']); $news = nl2br (strip_tags ($row13['projectcode'], '<a><b><i><u>')); $image = $row13['image']; $thumbnail = $row13['thumbnail']; $id = $row13['id']; /* display the data */ echo "<div class='portfolioproject'>";?> <div class='boxgrid captionfull'> <a id="<?php echo $id ?>" class="example_group" href="images/gallery/<?php echo $image ?>" title="<?php echo $title ?>" rel="gallery"><img alt="" src="images/gallery/<?php echo $thumbnail ?>" width="122px" height="122px"</a> </a>} <?php //Check whether the session variable SESS_MEMBER_ID is present or not if(isset($_SESSION['SESS_MEMBER_ID']) || (!trim($_SESSION['SESS_MEMBER_ID']) == '')) { echo "<form class='editbtn' action='editportfolio.php' method='POST'>"; echo "<input type='hidden' name='idf' value='$id' />"; echo "<input src='images/editbtn.png' type='image' value='Edit' />"; echo "</form>"; echo "<form class='editbtn' action='deleteportfolio.php' method='POST'>"; echo "<input type='hidden' name='ide' value='$id' />"; echo "<input src='images/delbtn.png' type='image' value='Delete' />"; echo "</form>"; } else { echo ""; } echo "</div>"; } /* if not displaying all news, give a link to do so */ if ($all == 0) { echo "<div class='show_all'><a class='show' href=\"{$_SERVER['PHP_SELF']}" . "?action=all\">Show all</a></div>\n"; } } /* this is where the script decides what do do */ echo "\n"; switch($_GET['action']) { case 'all': displayNews(1); break; default: displayNews(); } echo "\n"; ?> <?php //Check whether the session variable SESS_MEMBER_ID is present or not if(isset($_SESSION['SESS_MEMBER_ID']) || (!trim($_SESSION['SESS_MEMBER_ID']) == '')) { echo "<span class='show_all'>"; echo "<a class='show' href='admincp.php'> Admin</a>"; echo "</span>"; echo "<span class='show_all'>"; echo "<a class='show' href='logout.php'> Logout</a>"; echo "</span>"; } else { echo ""; } ?> No error messages are displayed, only the 'show all' button, and the 'admin' and 'logout' buttons if signed in! Any help on this would be much appreciated! Thank you Martin Hey guys, I wrote a code for displaying images in columns, but for some reason it's not working. Can you take a look and tell me what I'm doing wrong? $i = 0; if($i % 4 == 0){ echo ' <td width="25%" align="center" valign="top"> <a href= "'.$slika_velika.''.$slika_v.'" rel="lytebox" title="'.$naziv.' - '.$mjesto.' - '.$medalja.'" target="_blank"><img src="'.$slika_mala.''.$slika_m.'"width="200" height="150" border="0"></a><br> </td> <td width="25%" align="center" valign="top"> '.$naziv.' - '.$mjesto.' </td> <td width="25%" align="center" valign="top"> '.$medalja.' </td><br /> '; echo '</tr><tr>'; } $i++; } The output I'm getting now is one image below another. I would like to display them one next to another. Please help!!! I am trying to display two images per row. Will add in table tags later so it will look nicer. Anyway, it is leaving off the second image. So, I have 6 images and image number two is blank.
$dirname = "Files/$listingid/images/"; $images = glob($dirname."*"); /* $html .= '<table width="100%">'; foreach($images as $image){ $html .= "<tr><td><center>"; $html .="<img src=\"$image\" width=\"300\">"; $html .= "</a></center></td>"; $html .= "</td></tr>"; } $html .= "</table>"; */ $countImages = count($images) ; $imagesPerRow = 2; for ($i = 0 ; $i < $countImages; $i++) { //display image here $image = $images[$i] ; $html .= "<img width = \"200\" src='$image'>" ; if ($i % $imagesPerRow == 0) { //have displayed an entire row $html .= '<br>' ; } } Hi! I want the image of my site to be clickable so that it shows the next image contained in the result set of the sql query. Code: [Select] <?php require_once('includes/connection.inc.php'); $conn = dbConnect(); $sql = 'SELECT filename FROM images ORDER BY image_id DESC LIMIT 1'; $msg = ''; if(!$sql) { echo "Something went wrong with the query. Please try again."; } $result = $conn->query($sql) or die(mysqli_error()); if(mysqli_num_rows($result) == 0) { header('Location: empty_blog.php'); $conn->close(); } else { $row = $result->fetch_row(); $image = $row[0]; } ?> <?php include('header.php'); ?> <div class="content main"> <img id="image" src="images/<?php echo $image; ?>"/> </div> <?php include('includes/footer.inc.php'); ?> All the filenames of the images are contained correctly in the $result variable, all I need to do now is to fetch the next image in the set. How would I go about this? Any help is greatly appreciated! Hi All take a look at http://www.buypromo.co.uk/index.php in IE 7 or 8 the images at the bottom of the page are not showing up, whereas therest are find, any ideas? thanks ok I got the images to upload to the directory on the server. now I got some code to try to display the image on the same page after you submit it to the directory. so it's like, submit form-> images goes in server directory->echoes back out on same page but just above the upload form. please any help greatly appreciated. thanks. here is the code so far. Code: [Select] <?php // An Example about listing Images. $dir = "uploads/"; $odir = opendir($dir); while($file = readdir($odir)){ if(filetype($file) == "image/JPEG") { echo $file; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <p>UPLOAD YOUR PORTFOLIO AND PRICES</p> <p> </p> <p> <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form></p> </body> </html> Guys, i need your help,i have one table employee with empno=number,image=blob, images uploaded sucessfully and insert into database but when i am trying to retrieve records image are not displaying instead of it some encrypted form shows please help me Hi, sincerely hope i can get some help here. im pulling some images from my database but i want to display them horizontally for example 3 or 4 images in a row then it moves to a new row. so far i have only being able to display the images vertically. I am not sure if i should be using css or there is a way to do it with php. would appreciate any assistance. I have been tryin to get this done for sometime now and i need to complete this project. I'm new at this I'm having real problems with a rss box that I'm trying to incorporate onto the homepage of our website... The code I'm using as a basis I got from here - http://www.dynamicdrive.com/dynamicindex18/rssdisplaybox/index.htm It worked okay displaying title, date and content, however, we wanted it to display the first image of the blog entry as well. In the outputbody.php (the file that dictates what is shown in the rss box) I incorporated this code (shown in bold EDIT: with the bold tags around it! ) - Code: [Select] <?php //Function for ouputting the body of each RSS item displayed (inside loop)- DynamicDrive.com //For syntax pf bpdu, see: http://simplepie.org/docs/installation/from-scratch/ and http://simplepie.org/docs/reference/ //Function by default defines 3 different body outputs (templates). Modify or add additional templates as desired [b] function get_image($text) { $imageurl=""; preg_match('/<\s*img [^\>]*src\s*=\s*[\""\']?([^\""\'>]*)/i' , $text, $matches); $imageurl=$matches[1]; if (!$imageurl) { preg_match("/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $text, $matches2); $youtubeurl = $matches2[0]; if ($youtubeurl) $imageurl = "http://i.ytimg.com/vi/{$matches2[3]}/1.jpg"; } return $imageurl; }[/b] function shortencontent($content, $len=40){ if(strlen($content) > $len){ return substr($content, 0, $len - 6) . ' . . .'; } else { return $content; } } function outputbody($item, $template=""){ if ($template=="" || $template=="default"){ //DEFAULT TEMPLATE ?> <div class="rsscontainer"> <div class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></div> <div class="rssdate"><?php echo $item->get_date('d M Y g:i a'); ?></div> <div class="rssdescription"><?php echo shortencontent($item->get_description(), 400); ?></div> [b]<div class="rssimage"><?php echo get_image(); ?></div>[/b] </div> <?php } //end default template else if ($template=="titles"){ //"TITLES" TEMPLATE ?> <div class="rsscontainer"> <div class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>" target="_new"><?php echo $item->get_title(); ?></a></div> <div>Category: <?php echo $item->get_category(); ?></div> </div> <?php } //end titles template else if ($template=="titlesdates"){ //"TITLESDATES" TEMPLATE ?> <div class="rsscontainer"> <span class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></span> <span class="rssdate"><?php echo $item->get_date('m/d/y g:i a'); ?></span> </div> <?php } //end titlesdates template else if ($template=="mytemplatename"){ //"mytemplatename" TEMPLATE ?> //DEFINE ADDITIONAL CUSTOM TEMPLATE(s) USING SAME LOGIC STRUCTURE AS ABOVE //For syntax of template body, see SimplePie docs: http://simplepie.org/docs/installation/from-scratch/ and http://simplepie.org/docs/reference/ <?php } else die ("No template exists with such name!"); } //Closing function bracket ?> While it creates an imagebox nothing is shown and when you open the empty image box in the browser it displays the following URL - http://www.oururl.%20.%20.%20.</div>%20%20%20%20%20%20%20%20<div%20class= I have little PHP knowledge but don't really know where to start with this... please can anyone help or point me in the right direction. I appreciate that it is frustrating dealing with someone with limited knowledge but please have a little patience with me... Cheers people! The problem: I'm trying to create a page which outputs images from a folder which I have been able to do, but the problem I'm having is not being able to get the page to display the most recent image according to file modification date at the top. The first set of code below outputs the image timestamps in descending order, from newest to oldest which is what I want, but as soon as I change/add a couple lines of code (Shown in the second lot of code) to get the image file name along with the timestamp, the echoed list (timestamp and file names) gets muddled up in a random order. In short; As soon as the file names are retrieved with the timestamp, the list goes from being organised descendingly, to not. Show timestamp only code (1st lot of code): <?php //Open images directory $ignore = array("..","."); $dir = opendir("images1"); $images = array(); $sortedimages = array(); //List files in images directory while (($file = readdir($dir)) !== false) if (!in_array($file, $ignore)) $images[] = $file; foreach ($images as $image) { $filetime = filemtime("images1/$image"); $sortedimages[] = $filetime; } rsort($sortedimages); foreach ($sortedimages as $sorted) { //foreach ($sorted as $key => $value) //{ echo "$sorted<br/>"; } //} closedir($dir); ?> The show timestamp and file name code (2nd lot of code): <?php //Open images directory $ignore = array("..","."); $dir = opendir("images1"); $images = array(); $sortedimages = array(); //List files in images directory while (($file = readdir($dir)) !== false) if (!in_array($file, $ignore)) $images[] = $file; foreach ($images as $image) { $filetime = filemtime("images1/$image"); $sortedimages[] = array($filetime => $image); } rsort($sortedimages); foreach ($sortedimages as $sorted) { foreach ($sorted as $key => $value) { echo "$key and $value<br/>"; } } closedir($dir); ?> The changes made in the 2nd script from the 1st: //Changed: $sortedimages[] = $filetime; ---> $sortedimages[] = array($filetime => $image); //Included the previously commented out: foreach ($sorted as $key => $value) { } //Changed: echo "$sorted<br/>"; ---> echo "$key and $value<br/>"; Thanks for any help! I am currently looking to insert images into a database and then display them in php. I am thinking of storing the images as a VARCHAR data type but what would be a more suitable type? this is the line in my script that I have to show the image: Code: [Select] $output .= "<img>{$row['disp_pic']}</img></br>\n"; As you can see I added the image tag, but it wont show the actual image. IE shows it as a small square with another small square picture icon in the middle of it (i'm sure you guys know what i mean). I am trying to display images on a html page alphabetically in descending order by their filename. <?php $dir = "./plate_cache"; $handle = opendir($dir); while (($file = readdir($handle))!==false) { if (strpos($file, '.png',1)) { echo "<img id=\"plates\" src=\"/tags/plate_cache/$file\"></a><br />;"; } } closedir($handle); } ?> Any help is greatly appreciated! I want to resize both width and height of the thumb pic this is the php code <?php $id_member=$_SESSION['rid']; if(!empty($foto1_name)) { $nama_file=$foto1_name; $anton->sekur_upload($nama_file); if($valid) { $abpath = "conf/i/"; @copy($foto1, $abpath."/".$foto1_name); $abang_dom=$abpath."/".$foto1_name; list($width, $height) = getimagesize($abang_dom); if($width>200) { make_thumb("$abpath/$foto1_name","conf/i/thumb/$foto1_name",200); } else { $tujuan="conf/i/thumb/".$foto1_name; rename($abang_dom, $tujuan); } } $foto_old_name=$foto1_name; $foto1_name=$id_member."_".$foto1_name; $foto1_name=strtolower($foto1_name); $foto1_name=str_replace(' ', '', $foto1_name); $asal1="conf/i/".$foto_old_name; $asal2="conf/i/thumb/".$foto_old_name; $tujuan1="conf/i/".$foto1_name; $tujuan2="conf/i/thumb/".$foto1_name; rename($asal1, $tujuan1); rename($asal2, $tujuan2); } I want to set the size to 100 x 100, which part of the code that I need to edit? Is there any way to generate a small image of the 1st page of a pdf document without using a 3rd party like imagemagic. The site is hosted a register.com so I am thinking I am going to be limited to the basic php functions. |