Log in

View Full Version : Create thumb of a BIG JPG with Javascript or ASP



cyberd
06-02-2008, 05:37 AM
Hi there,

i want to Create thumb of a BIG JPG/GIF... with Javascript or ASP with giving max-height and max-width - no losing much quality like resizing and giving it external links... like this:


imgsizer options: maxheight=100 / maxwidth=100

<img src="http://www.oneothersite.com/a1.jpg" class="imgsizer">


is that possible - is there any script doing that already?

i prefer a free script ///

Thanx in advance

ps: Also i want to ask if there is any script that can encode my source on client's browser... Acctually when the user that viewing my html page will see a compressed and javascript encoded source...

Medyman
06-02-2008, 12:55 PM
You can resize images with JavaScript. This won't truly be creating a thumbnail and seems to me to be a complete bandwidth waste. ASP could handle such a thing though. This (http://www.tutorialized.com/view/tutorial/ASP-image-resize-and-convert/22159) tutorial looks promising. I don't know ASP so I can't help more than that.

Feel free to post in the ASP forum if you have trouble with that script.


ps: Also i want to ask if there is any script that can encode my source on client's browser... Acctually when the user that viewing my html page will see a compressed and javascript encoded source...
Such a script might exist, but it's 1000% useless to implement. So, I'd recommend not going down that route.

cyberd
06-03-2008, 05:47 AM
@medyman
first, i want to thank you answering parts of my question...
but as i said the pictures are on external liks (third's site page), so as i see the asp code does not help me :-( because talking for local files....

About the javascript - as you said will use the same bw (waste) but who cares... can javascript help me to give limits at images of external sites ?

Thanx in advance..

Medyman
06-03-2008, 01:47 PM
but as i said the pictures are on external liks (third's site page), so as i see the asp code does not help me :-( because talking for local files....

Have you tried just adding an absolute URI? It seems to be that there are security implications here but again, I don't know any ASP so I can't say if that's possible or not. Again, I'd refer you to the ASP forum where you might get a better answer.


About the javascript - as you said will use the same bw (waste) but who cares... can javascript help me to give limits at images of external sites ?
Well, you should care. But anyway, you won't get a true thumbnail with JavaScript. You can basically just resize an image. You can do this with CSS, so I don't see the point in using JavaScript here.

You might want to look into using CSS clipping (http://www.ibloomstudios.com/articles/misunderstood_css_clip/) to create your thumbnail.

cyberd
06-03-2008, 03:24 PM
i ve found this:

LINK TO IT (http://www.bigbaer.com/css_tutorials/css.scale.image.html.tutorial.htm)

is the best solution - at the moment - but i am searching it for aspect ratio resizing...

@medyman: asp is a server language not a client so - if use it i must download the picture (at server) and then making thumbnail - that is not a solution - i want on air solution simple and fast... as i said the images are at a remote servers...

cyberd
06-03-2008, 04:43 PM
and now i ve found with aspect ratio:


img.g10 {

width: expression(Math.min(parseInt(this.offsetWidth), 40 ) + "px");
height: auto;
}

Medyman
06-03-2008, 05:42 PM
and now i ve found with aspect ratio:


img.g10 {

width: expression(Math.min(parseInt(this.offsetWidth), 40 ) + "px");
height: auto;
}


That's IE only!