Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to let visitors download jpegs to their computer? 1

Status
Not open for further replies.

Jeanne

Technical User
Jan 15, 2001
45
US
I need a way to let visitors to our site download jpegs to their computer by clicking on a link.  

Basically I need a link ("click here to download") that will popup with a window that asks where the user wants the file saved, and then lets them do that.

Any and all help will be greatly appreciated.  Thank you.

Jeanne
 
Hi Jeanne!
Everyting you are talking about is absolutely useless.
If a user clicks on a link that means that he does want to save file and you don't have to ask again.
All you need is just a simple link:
<a href=&quot;something.jpg&quot;>something.jpg</a>

If you think that your users don't know what to do with it you may add something like that: &quot;Click with right-mouse button on a link and chose Save Image/Picture As to save the file.&quot;
It's one of the most obvious actions and there's no need to invent a new way to complete it.

Andrew | starway@mail.com
 
The browser is being &quot;smart&quot; by automatically attemppting to display MIME types that it understands (and, of course, JPEG is among them) and you can not stop them from doing this. So, the only solution is to change to some other extension (e.g. ZIP them) or make them right-click the link and choose &quot;save target as...&quot;

---
---
 
Thank you Andrew for your brutal response (and thank you uladzik for your kinder, gentler one).

I do have a link like you suggested but the browser opens a new window to display it.

We are Mac users so I can't use zip. Our visitors will be a mix of Mac and PC users so I will try the right-click, control-click thing and see if my boss will let me do that. He was pretty adamant about there being a way to do this as a basic link, though.

Thanks again for your help!
 
Some ppl like to display thumbnails or images that are severely degraded from the original to save on load time. Therefore a link to the 'source' image is needed.

<a href=&quot;source_image.jpg&quot;><img src=&quot;degraded_image.gif&quot; border=&quot;0&quot;></a>

I use this all the time. I have a page where ppl can download 1024x768 images that are too humongous to show on a web page so I create degraded thumbnails and link to the source image.

Friendly enough ?? ;) » » » » » »
Mike Barone
FREE and Pro CGI/Perl Scripts

FREE Scripts
 
Thanks, Mike! And, yes, friendly enough. I appreciate it.

My page has thumbnails, with a link to the larger jpg as indicated above.

Do your people have to right -click to download?

I talked to my boss & he still insists that it can be done with a link, without doing the right/control-click thing.

I am sure there are javascripts to do this, but I have heard that they can have BAD results if they fail to run properly.

Jeanne
 
i think you might be able to do it with a server-side script.... have it send the mime types as something strange that the browser doesn't know how to read, it should then prompt the user to save it.

if i get some time to work on it, i'll write a perl script that should do what you are asking. luciddream@subdimension.com
 
Jeanne,

There IS a way to do this without JavaScript or requesting that the user right/control-click...

First go to where you can download a Macintosh shareware utility called ZipIt. (It allows you to compress files into '.zip' format right on your Mac.)

Next, compress all your jpegs into .zip files.

Next, link to each &quot;zipped&quot; jpeg file like so:
<a href=&quot;filename.zip&quot;>Click here to download image</a>

When the user clicks the link, the file will begin to download automatically (no right-clicking req'd). To see an example, go to (The only difference between what I've done and what you are trying to do is that I'm using &quot;zipped&quot; pdf files instead of jpegs.)

By the way, Mac users can use StuffIt Expander to uncompress the '.zip' files.
 
I'm not trying to be rude, but does your boss have the technical understanding necessary to make that request? Sometimes, non-technical managers ask for things that cannot be done.

You said he &quot;insists it can be done with a link&quot; which leads me to believe that he has seen this somewhere in the past (although I can't imagine where.) If that is indeed the case, perhaps you could ask your boss where he saw this. If you could see it first-hand, it might help you come up with a solution.

Short story, I had a supervisor when I was still in the military INSIST that you could have a form input that would allow the user to click and highlight all the selections or parts of them. I spent several hours trying to find what he was talking about. He was so cryptic about it. Then It dawned on me that he was probably talking about a select box in which the user can hold the control key while making multiple selections. I took this to him and of course that's what he was talking about. That's when I realized that my bosses don't always know how to convey what they really want. Kevin
slanek@ssd.fsi.com
 
johntabita - thanks for the info! I will check it out. My boss even likes this one!

Kevin - no I don't take you as rude - I agree with your statement. My boss has a wide variety of knowledge in computers, and many times makes me look so I will learn. In this instance, he doesn't remember what was done for this previously, but when I told him of johntabita's suggestion, he recalled that he had that shareware at one time, and did use that.

Thanks again & I'll let you know how it works out!
 
I see. johntabita's post must have come in while I was typing my own. Not being all that familiar with the Mac environment, maczipit is not something I've heard of.

Good luck and let us all know how it goes. :) Kevin
slanek@ssd.fsi.com
 
Thanks very much johntabita!

It works great and my boss is happy (and you know if my boss is happy then I am very happy)!

I appreciate everyone's willingness to help me in my time of need. I hope I can reciprocate one of these days.
 
You're welcome. Glad that I could help.

John

I understand that thing about happy bosses =)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top