PDA

Click to See Complete Forum and Search --> : Showing AND downloading a picture in one link


MarcelB
Jul 4th, 2001, 09:38 AM
Hi all,

I have this page on which people can download a picture by rightclicking a link to it and selecting "Save target as...". Now I also want to be able to show the picture when someone leftclicks it. No problem so far.

But sometimes the picture that I want to show is too big to fit the page, so I want to resize it first. So I've written a function that determines the width and height of the picture, and then adjusts the display width and height according to the maximum width and height I give to the function as parameters.

So when a user leftclicks the link, it needs to be redirected to another ASP-page first, where I get the path to the picture as a parameter, then determine the display size by running it through the function, and show it on that new page. (My page is built up of frames, so the user won't notice the redirection)

So now on my page, the code gets something like this:


===========================

<form name="myform" method="post" action="show_picture.asp">
<input type="hidden" name="pic">

<a href="..\upload\049704.jpg" onClick="javascript:return submitform('..\upload\049704.jpg')">049704.jpg</a>

</form>

===========================


and the function submitform looks like this:

===========================

function submitform(sPic)
{
myform.pic.value = sPic;
myform.submit();
return false;
}

===========================


Now for some reason, I get this s t r a n g e error, namely:
'Expected hexadecimal digit' on the line of the href.

Anybody got any ideas on why I get this error, or an easier way to do what I want to do? Any help is highly appreciated.

Thanx in advance,
Marcel

Sastraxi
Jul 4th, 2001, 10:51 AM
Do you actually have the .. before the filename? That's bad to have, and also try changing the \'s to /'s. That may help alleviate the problem. And also change pic.value in your function to pic.src. I think that may help.

MarcelB
Jul 6th, 2001, 02:17 AM
Well, I have it working now the way I had it. The problem was that some files in the database had the full path as filename, and some just had the relative path. As soon as I realised that, it was a matter of checking for it, dealing with it, and it worked. :)