473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How do i add pictures from a dir into a table(no limit on rows either)

2
ok I need a way cause my source code does not like this. I made it but it doesn't use tables and I want this to use tables instead of how i have this set up. Can someone please help me with this? Here is the current code i have set up for use with this.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $path = "upload/";
  3. $dir_handle = @opendir($path) or die("Unable to open folder");
  4.  
  5. echo "<title>Image Uploader</title>";
  6. echo "<form action='uploader.php' method='post' enctype='multipart/form-data'>";
  7. echo "<div align='center'><label for='file'>Select a file:</label> <input type='file' name='userfile' id='file'></div> <br/>";
  8. echo "<div align='center'>File types allowed: .jpg .jpeg .bmp .png .gif</div>";
  9. echo "<div align='center'>Max file size: 2.0 MB</div>";
  10. echo "<div align='center'><input type='submit' name='submit' value='Upload' /></div>";
  11. echo "</form>";
  12. echo "<center><a href='png.php'>Click here </a>to view PNG files</center>";
  13. echo "<center><u><h2>Uploaded Photos</h></u></center>";
  14. echo "<center>Pictures open up in a new Tab</center>";
  15. echo "<center>Click the picture to enlarge</center>";
  16. $filecount = count(glob("" . $path . "*.*"));
  17. echo "<center>    </center>";
  18. echo "<center>Total files in our database is: '$filecount'</center>";
  19. echo "<center>PNG files are not listed here as they slowed loading counter is right</center>";
  20. while (false !== ($file = readdir($dir_handle))) {
  21. if(ereg("(.*)\.(jpg|bmp|jpeg|gif)", $file)){
  22. echo "<a href='$path$file' target='_blank'><img src='$path$file' alt='$file' width='200' height='200'></img></a>";
  23. }
  24.  
  25.  
  26. }
  27. closedir($dir_handle);
  28.  
  29.  
  30. ?>
  31.  
Jan 20 '10 #1
3 1382
Atli
5,058 Expert 4TB
Hey.

I don't think I'm getting the problem here. It just seems to me like you need to add the HTML for your table around your <a><img></a> tags.

What exactly is it that you are having trouble with?
Jan 21 '10 #2
code green
1,726 Expert 1GB
I'm guessing this does not render the way you hoped, so you are giving up with <div> and going the <table> root.
HTML standards frowns upon the use of tables for page layout.
When the page renders copy and paste the source code to W3C Markup Validation Service.
If you correct the HTML errors you might just succeed
Jan 21 '10 #3
dahvie
2
The problem is when this is displayed it doesn't look right and the pictures get off centered sometimes so i wanted to make a better table then what i have used

Sorry for the bad english not good in this subject
Jan 21 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Klaus Johannes Rusch | last post by:
How can I define a table such that page breaks only occur between table rows, not within a table row, when printed with current browsers? -- Klaus Johannes Rusch KlausRusch@atmedia.net...
2
by: Andy Fish | last post by:
Hi, I am trying to show/hide a group of table rows using javascript and CSS. if I group them in a <tbody> element I can do: my_tbody_element.style.display="none"; to hide them and ...
3
by: AR | last post by:
Hi, How can I hide table rows? ... tried with the following example: FireFox works... How to do the simillar in IE6? <html> <head> <script language="javascript"> function hide_row() { var v...
3
by: ken | last post by:
Hi, I was wondering how the 4k table record limit is counted. I have access 2k. I text fields are 256 chars. Memo fields are not included in the calculation. What about yes/no fields would that be...
3
by: Bijoy Naick | last post by:
I have something strange going on.. My .aspx page contains a file upload control, a "Import Data" button, a "newTransactions" <asp:table>, a"SaveTrans" button and an confMsg label. First the...
1
by: jbreaker | last post by:
Hi - I have a table with about 30 rows, which contain a checkbox and a bit of text each. What I'm trying to find a way to do is to have 2 buttons at the bottom of the page - HIDE & SHOW. When the...
7
by: leiño | last post by:
Hi, i am adding table rows dynamically with javascript. This works fine. The table is inside a div with scrolls, initially with 6 rows: ..... <div style='overflow:auto; width:100%;...
2
by: Garg | last post by:
How do I hide a paricular tablerow during run time? I have two table rows with ids row1 and row2. I want that if a particualr condition is true, then row 1 should be displayed on the web page,...
2
by: kalyanilovesme | last post by:
Hi I have a html table.. and i am adding the table rows dynamically... actually table rows are 64.. but according to the program some are visible and other are invisible.. i want to calculate...
6
by: philmetz | last post by:
Hi Does anyone have a simple way to expand and collapse table rows. For example i will have 26 rows (one for each letter of alphabet) then i can say expand A and i will get a list of things there?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.