I need a script that will display jpg files in the current directory. I know there are lots of these around, however none of them seem to be what I want, or need.

I just want to be able to configure how many images across/down, and have a next/previos, etc buttons. I do not need the images resized, no thumbnails, no voting, nothing other than the images displayed.

If you know of anything like this, or are willing to write this, please contact me....

Thanks,
Brian

    What do you mean by "Current" directory? And what do you mean by prev/next? It would be hard to do a prev/next if you are just getting the images from a folder. If you were using a database to store the image names it would be easier.

      4 days later

      By current, I mean the directory that the php file is loaded into.

      I said that so that the file would not transverse directories. I want to be able to put the file in various directories, and have them be seperate.

      I want to use a php script, because I will be adding/deleting files all the time, and do not want to have to edit an html file....

      As far as the previous/next, that is a feature that would be helpful but not required....

      If I could get a script that would allow me to specify the number of files to be displayed horizontally, then that is all I really need.

      For example, I could say 4 images per line, so if there were 12 images there would be 3 lines....

      All this need to be dynamic, and if possible, clicking on an image would promt to download, as opposed to opening the image, but this is not required....

      I just need to display a dynamic graphic gallery....

      I hope that is not too confusing...

      Brian

        First, read all of the files in the current directory into an array. Get rid of any that are not images (use your own filter requirements, depending on whether you want to include gif, tif, bmp, etc.).

        Next, iterate through the array, building a table as you go. Each image is surrounded by a <td> and </td>. Every 4 (or 5, or 3, whatever you choose) files, put in a </tr> and <tr> to start a new row.

        --

        There are many scripts available for what you are trying to do. Some are more complex than others. I recommend you start at hotscripts.com -- they have TONS of scripts.

          I have been looking around. I cannot find such a simple script, they all want to create thumbnails, or implement voting, or want mysql access or something.

          I just need this very simple version, I posted here hoping someone might want a small challenge and just write it.....

          Brian

            Here is a simple gallery I use. This one is simple because you create the thumbs before you put it onto your server. The thumbs go into the "small" directory located in your "screenshots" folder and then you put the original images in the "large" directory located in your "screenshots" directory.

            Very simple and if you don't mind doing image editing prior it really saves over head.

            function SCREENSHOTS(){
            
               $count = 1;
               $dirstring = "screenshots/small/";
               $dirstring2 = "screenshots/large/";
               $mydir = dir('/home/yourusername/public_html/screenshots/small');
            
               echo "<table border=0 cellpadding=0 cellspacing=20 bordercolor=#000000 width=100%>";
               while(($file = $mydir->read()) !== false) {
                  if ($file !== "." && $file !== "..") {
                if ($count == 1) {
                    $fstring = substr("$file", 0, -4);
                    $display = "$dirstring" . "$file";
                    $display2 = "$dirstring2" . "$file";
                    echo "<table border=0 cellpadding=0 cellspacing=20 bordercolor=#000000 width=100%><tr><td width=33% align=center><a href=\"$display2\"><IMG border=0 src=" . "$display ><BR>" . $fstring . "</a></TD>";
                    $count++;
                }
                elseif ($count == 2) {
                    $fstring = substr("$file", 0, -4);
                    $display = "$dirstring" . "$file";
                    $display2 = "$dirstring2" . "$file";
                    echo "<td width=33% align=center><a href=\"$display2\"><IMG border=0 src=" . "$display ><BR>" . $fstring . "</a></TD>";
                    $count=1;
                }
            
              }
               echo "</table>";
               $mydir->close();
              }
            }

            Don't forget to change the value for "$mydir".

              That is the issue, I don't need nor want thumbnails. The images I am hosting are going to be for cell phones, so they are already very small....something like 120x96 pixels.....

              That script seems very simple, but I don't know php....now if it didn't have thumbnails, and a a hardcoded directory it would be perfect.....anyone know how to tweak it?

              Brian

                To be honest, PHPBuilder is mainly for developers that want to share code, or need help with code. Many of us are paid for writing code, although some of us will get in on open source projects.

                However, coming in without so much as a how-do-you-do, asking for people to write something for you, will not get you too many responses. Most are not willing to hand out free code like that.

                You might get lucky, and have someone give you what you want, but since you don't understand php at all, I doubt you'll get what you're looking for.

                Good Luck.

                  Interesting,

                  I hope not everyone here is not as negative as you. I was unaware of any rules saying that I needed to say hi to everyone.

                  I also never said I was looking for a freebie, If someone was willing to write somthing for me, I would be more than willing to discuss possbile payment..... I am however trying to keep cost down, as the site I am developing is being offered to the intended audience for free.....

                  If you had paid attention to my original post you would have seen "If you know of anything like this, or are willing to write this, please contact me.... ", nowhere in this statement do I see "yo, any schmucks willing to do some pro-bono work" do you?

                  I guess if you are not interested in helping with the issue at hand, you might as well keep out of my business.....

                  Thanks..

                    I wasn't being negative, I was being realistic. I have been here a while, and I know what sort of queries people here are willing to respond to... You wouldn't believe how many people come in to the forums and their first post is "I need, please write it for me." I apologize if I somehow offended you. However, in my defense...😉

                    I posted here hoping someone might want a small challenge and just write it.....

                    For the heck of it, I wrote a quick and dirty program for you. I make no warranties about it working on any other system, but it does work on my server (as you can see here). There are MANY ways it could be improved, such as offering multiple pages for excessive files, error checking, etc. At least, I hope it gets you started in the right direction.

                    You can grab the code here.

                    Incidentally, the hotscript.com link I provided you took you directly to a page of photo album programs. On that first page, there was a link to one simply called Gallery:

                    Description: image gallery script that scans directories for images and creates the corresponding links. no thumbnails used. no installation needed. all very basic and easily customized. just copy and paste. check the url as an example.

                    If my script doesn't help you, this one seems to be exactly what you described you were looking for.

                    I would humbly suggest that you don't be so quick to jump down the throat of people who answer your posts. I gave you some help, and offered you some advice. You don't like it, fine. But that does not mean you need to tell me to "mind my own business." If you want me to mind my own business, then either I need to not be a contributor to this site, or you need to not post your questions in a public forum. I doubt the former is going to happen.

                      If you don't want to use thumbnails remove the HTML tag <a> from the code and only put the pictures into the samll directory inside your screenshots directory.

                        Write a Reply...