?
Solved

How to select a image file from a dropdown list

Posted on 2003-03-13
4
Medium Priority
?
190 Views
Last Modified: 2006-11-17
I am trying to be create a dropdown list of all my .jpg files in a dir called http://localhost/images. I would like to then select the image from the list and then display it. This might be easy but I just can't seem to get it.

Thanks

0
Comment
Question by:mratcliffe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 15

Expert Comment

by:VGR
ID: 8131942
1) get all your files *.jpg via a dir(), readdir() or exec ("dir")
2) build the HTML page with a SELECT and one OPTION for each file
3) add an OnChange event handler / or (simplier) a button "view"
4) react to event / take action on button press to :
5) show the image in a separate/same window

easy

which part(s) of the above do require some coding help from my humble self ?
0
 

Author Comment

by:mratcliffe
ID: 8135609
Sorry, but being a newbie, I really don't see how  to code this. (1-5) It looks like you want me to create a check box with all of my images as the options. I have a 2 hundred drawings (images) and a check box seems unpractical. Thanks fro responding though.
0
 
LVL 15

Accepted Solution

by:
VGR earned 195 total points
ID: 8138336
no checkbox, a SELECT. This is a listbox
you asked for a dropdown list. That's a listbox.

I'll try to help you anyway : I send you to the documentation of PHP (the online version is at http://www.php.net/manual/en/
1) type "readdir" +ENTER and then "dir" +ENTER in the "search" textbox
2) you have to know how to build an HTML FORM
3) in the FORM , add a button : <input type=submit name=ipressedit value=View>
Make sure the ACTION=$PHP_SELF
4-5) just before echoing the FORM to the "screen", place the action handling like this :
(supposing register_globals=On, let's keep things as simple as they should be :D )
if (isset($ipressedit)) {
  // here display the selected image the way you want, either in an IMG tag either in a popup window, whatever
  // (6)
} // if ipressedit

NB (6) : put "exit;" here if you want to stop before re-displaying the selecting FORM
0
 
LVL 15

Expert Comment

by:VGR
ID: 8139308
thanks for grade B
did I answer precisely a precise question ? I think so.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question