1. The user identifies any directory on his computer.
2. I go through that directory and find all JPG files in it.
3. I display those JPG files.
This is what I know:
1: The input type “file” would let them choose any file in that
directory and send me the complete pathname (the drive, list of
directories leading to it and file name.) I then ignore the file name
at the end and I have the directory.
Is there a way for them to browse to a directory and choose just a
directory instead of a random file within that directory? This is
minor, but still I am only asking for the drive and directories part
of the pathname.
2: I can get a list of the file names in that directory using the
opendir and readdir functions.
3: I go through the list of file names and want to use html IMG to
display the JPG file. This is the real problem. How can I specify
that the SRC is an arbitrary file on their computer? Using the
pathname (drive, directories and file name) doesn’t work.
I can get the contents of the file using the fopen and fread
functions. But how do I specify the contents as the html SRC? Do I
have to save the file contents to the server first? Then would I need
to assign it a file name e.g. “A1”, “A2” etc? And then delete it
after displaying it? And if there is a problem during that process
and it doesn’t run to completion, I have to periodically delete these
“A1” etc. file names that will not be deleted by the process that
created them. How do I tell if it is a file that is currently being
displayed and to not delete it?
Thanks,
P -
No, you will only get the filename, not the path to the file on the
users hard drive, for this you need to have a normal input (type text)
where they manually enters the path.
> 2: I can get a list of the file names in that directory using the
> opendir and readdir functions.
No you can't, those will only work on the server, not on the client
side, if you want to do something on the client side, then you use a
client side scripting language like javascript.
> 3: I go through the list of file names and want to use html IMG to
> display the JPG file. This is the real problem. How can I specify
> that the SRC is an arbitrary file on their computer? Using the
> pathname (drive, directories and file name) doesn’t work.
file://...
> I can get the contents of the file using the fopen and fread
> functions. But how do I specify the contents as the html SRC? Do I
> have to save the file contents to the server first? Then would I need
> to assign it a file name e.g. “A1”, “A2” etc? And then delete it
> after displaying it? And if there is a problem during that process
> and it doesn’t run to completion, I have to periodically delete these
> “A1” etc. file names that will not be deleted by the process that
> created them. How do I tell if it is a file that is currently being
> displayed and to not delete it?
Uploading images to the server and then display them once is waisting
bandwidth and time. To delete the file after display you would need a
wrapper script that reads the file and then sends the data and then
deletes it when it has sent the whole file, of course if the visitor
would do a reload there wouldn't be any images to display.
There are a lot better ways to display images, just look at such
applications like gqview or kview.
--
//Aho
Javascript won't do it, either. Security restrictions will prevent it.
>
>> 3: I go through the list of file names and want to use html IMG to
>> display the JPG file. This is the real problem. How can I specify
>> that the SRC is an arbitrary file on their computer? Using the
>> pathname (drive, directories and file name) doesn’t work.
>
> file://...
>
>
>> I can get the contents of the file using the fopen and fread
>> functions. But how do I specify the contents as the html SRC? Do I
>> have to save the file contents to the server first? Then would I need
>> to assign it a file name e.g. “A1”, “A2” etc? And then delete it
>> after displaying it? And if there is a problem during that process
>> and it doesn’t run to completion, I have to periodically delete these
>> “A1” etc. file names that will not be deleted by the process that
>> created them. How do I tell if it is a file that is currently being
>> displayed and to not delete it?
>
> Uploading images to the server and then display them once is waisting
> bandwidth and time. To delete the file after display you would need a
> wrapper script that reads the file and then sends the data and then
> deletes it when it has sent the whole file, of course if the visitor
> would do a reload there wouldn't be any images to display.
>
> There are a lot better ways to display images, just look at such
> applications like gqview or kview.
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================
>>> 2: I can get a list of the file names in that directory using the
>>> opendir and readdir functions.
>> No you can't, those will only work on the server, not on the client
>> side, if you want to do something on the client side, then you use a
>> client side scripting language like javascript.
> Javascript won't do it, either. Security restrictions will prevent it.
You are right, must been thinking of trusted java applet that can get
some local file system access, even so, I don't believe it would be a
good solution.
--
//Aho
Can anyone give me a straight answer as to how I can do what I
describe? I could even pay money for an answer.
P -
You can't. PHP runs on the server and you are looking for something on
the client. Additionally, nothing loaded from the server can access
data on the client. The only exception would be a FILE type field,
which can pass along a file name.
To enable what you want to do would create a huge security hole in the
internet, allowing all kinds of hackers access to your computer.
I thought we had given you a straight answer
1. You can't make it with php, or any other server side script language.
2. You can't do it with client side script language.
3. You better use a stand alone application run on the users computer,
pick one you like from the following page:
http://en.wikipedia.org/wiki/Comparison_of_image_viewers
--
//Aho
You have had lots of straight answers. I tell you again, what you say you
know is all wrong. You cannot do it. Period!
PHPBABY,
Are you attempting to write a client-side application using PHP do
what you are asking? (ie. are you writing PHP-GTK to achieve this?)
Steve
Some people say I can. PHP can invoke other languages.
- Hide quoted text -
>
> - Show quoted text -
Then go ask those people how to do it!
> - Hide quoted text -
>> - Show quoted text -
>
>
You know, "some people" have told me that you can fry an egg in a
working refrigerator. I have not been able to do it yet. "Can anyone
give me a straight answer as to how I can do what I describe? I could
even pay money for an answer."
Do you know a good definition of insanity? One might be "repeating
attempts to do the impossible, and expecting a different outcome".
Why are you replying to my post?
>
> You know, "some people" have told me that you can fry an egg in a
> working refrigerator. I have not been able to do it yet. "Can anyone
> give me a straight answer as to how I can do what I describe? I could
> even pay money for an answer."
>
You use a portable camp stove, silly.
And I claim my £5.
> Do you know a good definition of insanity? One might be "repeating
> attempts to do the impossible, and expecting a different outcome".
No, that's normal for most people in denial, or with religious conviction.
While the PHP Script can't do it alone,
you can embed client side code to meet the need.
Several users suggested Java.
If you are open to an ActiveX solution ( requires browser
to be IE on Windows system ) then this becomses easy.
Our MetaDraw control can display local ( or remote)
JPGs ( or other image formats ) within a scrollable,
zoomable client side window. Also in Active X it
is easy to handle the directory listing and file
deletions ( if allowed by the user ).
If you are interested, contat me at
Jeff AT Bennet-Tec.com
============================
On May 4, 9:28 am, PHPBABY3 <shymath...@gmail.com> wrote:
Some people are wrong.
And even if you use them, the user has to give permission for the script
to access his/her disk - which no intelligent user will do. And it
won't work on non Windoze systems.
What if you just allow him to mass select and mass upload at once the jpgs?
He'd need to have flash for this to work tho. But seriously the ability
to select all the images at once and just send them to the server would
work.
perhaps you could do something with file://
?
---------------------
The Developer Network
PHP Classes and Snippets
http://thedevnet.com
No, you can't.
Gregor
Just because it's normal for deviant classes of people, doesn't
make it not insane.
Cogitate on this: It's normal for an insane person to be insane.
If a person is in denial that smoking tobacco will harm them,
they are not in touch with reality, i.e. they are insane.
If a person believes ancient religious myths that are contrary to
what has been well confirmed scientifically, and spends his/her
whole life dedicated to service of a church that preaches those
myths, that person is not in touch with reality, i.e. insane.
Just because the Constitution of the USA grants people the *right*
to such insane religious beliefs, doesn't mean the people holding
such beliefs aren't insane, it just means that being insane in such
ways is guaranteed as a right.
By the way, you can't be free to believe what you want, unless you
are free to refuse to believe what others try to force/coerce you
to believe instead, hence the Constitutional guarantee by necessity
must include the right *not* to believe what you don't want to
believe.
<satire>Hey, somebody said that it's possible to fly at warp speed
past a star, which causes you to go back in time, so it must be
true, and if I had any money I'd be glad to pay money to anyone who
would show me in detail how to do it, so that I can prevent
somebody from setting a fire that burned up almost all my personal
property in 1972.</satire>
By the way, there actually is a way to accomplish what the OP
really wanted: Write a PHP script that teaches the user to obey
instructions from the PHP application, then give the user
instructions to go to a particular Web site and download a program
and run it without checking what it really does. The program
actually shows images to distract the user, while covertly
uploading the user's banking account and credit-card numbers and
access passwords and security questions and social-security number
etc. to a criminal organization. By the time the user has broken
away from the images being shown, it's too late, the user's bank
account is drained and also gotten the maximum allowed overdraft,
and all his credit cards are maxed out plus some more, and his home
has been triple mortaged with all monies going to the criminal
organization, and a person wearing a mask of the user's face and
carrying forged versions of the user's driver's license and other
identifying papers in a wallet, who "accidently" dropped the wallet
on the floor of the bank before driving the car which is of the
same make and model as the user's car with forged license plates to
match the user's *real* car right to the user's neighborhood where
it "disappeared". By the time the user has hung up the phone from
an urgent call from the bank complaining about the overdrafts, the
police are already at his door to arrest him for the bank robbery,
especially since some of the money matching the serial numbers of
the stolen money is hidden in the user's front-yard bushes visible
to anyone coming up to the door. By the time the user gets out of
prison, it's too late to recover anything.
Actually all the PHP script has to do to cause the user to see a
folder full of images is to instruct the user how to open the
folder containing the images, then select view by thumbnails, then
maximize the folder containing the images so that all the
thumbnails will be visible at one time without scrolling, then
minimize the Web browser and any other windows that might be
covering up some of the thumbnails.
The OP didn't say the images needed to be visible at full size.
Thumbnails should be sufficient to satisfy the OP's question.
I'm sure there are a lot of dumbshits out there who would follow the
instructions blindly. Simply because they are like sheep. Like in the James
Bond movie where he hands the guy his cigarette case and tells him that
there is a bomb inside it, if he moves even the slightest it will explode.
Or some guy comes up to you, tells you to hold the stick of dynamite and
lights the short fuse. He tells you not to move or you'll die.
Hell, if some damned jackass wants me to open up my files to him, fuck you
buddy, bye. I'm done. You hand me a stick of dynamite, I'm gonna shove it
back in your face.