Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Resize all images dynamically.
- From: evdo.hsdpa at gmail.com (Robert Kim Wireless Internet Advisor)
- Subject: [Javascript] Resize all images dynamically.
- Date: Fri Jun 24 18:27:49 2005
anyone know how to enable java on a pocket pc os?? that'd be cool.
On 6/24/05, Shawn Milo <shawn.milo@xxxxxxxxx> wrote:
> Recently, I was stumped. A user wanted to be able to upload images to
> my ASP app, but have thumbnails displayed, and a new window to open
> with the full-size picture if the thumbnail was clicked.
>
> I couldn't find any solution in ASP, without buying a plug-in. I
> didn't want to install ImageMagick on the server and run a shell
> command because I didn't want to add another dependency.
>
> Instead, I fell back on good old JavaScript to do it for me. I resize
> the images dynamically and each image is a link to a new window
> containing the full-size image.
>
> Caveat:
> Yes, I know I'm loading the full-size image and just making it look
> smaller, and that this is inefficient. However, the originals aren't
> too huge and it's only available within the intranet. Also, the
> alternative is that the PR person e-mails the pictures to everyone in
> the company, which bogs down the e-mail.
>
> Just thought I'd throw this out there in case anyone could use it, or
> anyone had any constructive feedback.
>
> Thanks,
> Shawn
>
>
> function resizeImages(){
>
> maxSize = 100;
>
> for (x=0;x<document.images.length;x++){
> iHeight = document.images[x].height;
> iWidth = document.images[x].width;
>
> if (iHeight > iWidth){
> sizeGuide = iHeight;
> size2 = iWidth;
> }else{
> sizeGuide = iWidth;
> size2 = iHeight;
> }
>
>
> if (sizeGuide > maxSize){
>
> sizeRatio = sizeGuide / size2;
> newSize1 = maxSize;
> newSize2 = newSize1 / sizeRatio;
>
> if (iHeight > iWidth){
> document.images[x].height = newSize1;
> document.images[x].width = newSize2;
> }else{
> document.images[x].width = newSize1;
> document.images[x].height = newSize2;
> }
>
>
>
>
> }
>
>
> }
>
> }
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
--
Robert Q Kim, Wireless Internet Advisor
http://evdo-coverage.com
http://wirelessinternetcoverage.com
http://hsdpa-coverage.com
2611 S. Pacific Coast Highway 101
Suite 102
Cardiff by the Sea, CA 92007
206 984 0880
- Follow-Ups:
- [Javascript] Resize all images dynamically.
- From: Shawn Milo
- [Javascript] Resize all images dynamically.
- References:
- [Javascript] Resize all images dynamically.
- From: Shawn Milo
- [Javascript] Resize all images dynamically.
- Prev by Date: [Javascript] IE/win click detection, not on text
- Next by Date: [Javascript] Resize all images dynamically.
- Previous by thread: [Javascript] big numbers in javascript
- Next by thread: [Javascript] Resize all images dynamically.
- Index(es):