1. AJAXspacer
  2. ASPspacer
  3. CSSspacer
  4. Javascriptspacer
  5. Windows 應用程式spacer
  6. 網頁設計
  7. 評論、短文、雜文spacer
  8. 版主spacer
  9. 最新回應spacer


ASPJpeg 縮圖製作例

ASPJpeg 這組套件,事實上我沒有介紹太詳細,最近有人詢問功能,自己看了自己的文章,只有一個字-汗!那就快補點有用的。


'(1)建立 ASPJpeg 物件
Set Jpeg = Server.CreateObject("Persits.Jpeg")

Jpeg.Open "c:\path\myimage.jpg"

' (3)指定新尺寸
L = 100

Jpeg.Width = L
Jpeg.Height = Jpeg.OriginalHeight * L / Jpeg.OriginalWidth

Jpeg.Save "c:\path\thumbnail.jpg"


原則上不複雜,其中步驟(2),可以直接銜接到上傳的圖檔,ASPJpeg 100% 支援中文檔名,這點不用擔心。

步驟(5),當然你可以使用 Server.MapPath() 使縮圖存放在網站之下。

在步驟(4)中,計算縮放比例,這點我是一定會處理,尤其要處理的檔案是直式或橫式,如果不知道尺寸,根本很難辦,在找到 ASPJpeg 前,我都使用 imageSize 這個套件來取得圖片尺寸,在頁面上顯示時,加以適當調整。

但,ASPJpeg 本身就有偵測圖片尺寸功能,也就是建立好 ASPJpeg 物件及取得圖片後(步驟(1)(2)),原始圖檔的寬度為 Jpeg.OriginalWidth,而高度為Jpeg.OriginalHeight,這裡沒有解析度的問題,一律為像素。


If jpeg.OriginalWidth > jpeg.OriginalHeight Then
   jpeg.Width = L
   jpeg.Height = jpeg.OriginalHeight * L / jpeg.OriginalWidth
   jpeg.Height = L
   jpeg.Width = jpeg.OriginalWidth * L / jpeg.OriginalHeight
End If

不過 ASPJpeg 強就強在,他還可以指定「等比」,上面的程式太囉嗦,改成:

jpeg.PreserveAspectRatio = True

If jpeg.OriginalWidth > jpeg.OriginalHeight Then
   jpeg.Width = L
   jpeg.Height = L
End If

ASPJpeg 縮圖的效果,以 800X 600 尺寸,實作的經驗,大約可以保持在 50K 左右,如果圖檔內容色階較多時,我看過有的上百K,甚至達 300K,但不管怎麼說,都一樣無損「強大」的美稱。

卜維丰 12/3 07'



Luiz Fernando Monteiro Bittencourt   2017/11/13 上午 09:38:00

I really love your site.. Pleasant colors & theme. Did you create this amazing site yourself?
Please reply back as I'm attempting to create my very own site and would like to find out where you got this from
or exactly what the theme is named. Thank you!

home security systems reviews australia   2017/11/12 下午 01:41:00

To keep your possessions safely?

Lelio Vieira Carneiro Junior   2017/11/10 下午 12:13:00

Hey There. I found your blog using msn. This is a really well written article.
I'll make sure to bookmark it and come back to read extra of your helpful info.
Thanks for the post. I will definitely comeback.

How do I stretch my Achilles tendon?   2017/8/21 下午 02:11:00

Heya i'm for the first time here. I came across this board and I to find It truly helpful & it helped me out much.
I am hoping to present one thing again and aid others such as you helped me.

http://evanescentcage80.jimdo.com/   2017/8/13 上午 05:35:00

Hi, every time i used to check weblog posts here early in the morning, as i love to learn more and more.

Can exercise increase your height?   2017/8/4 上午 10:32:00

This blog was... how do I say it? Relevant!!
Finally I have found something that helped me. Appreciate it!

How do I stretch my Achilles tendon?   2017/7/31 上午 11:59:00

Thanks for the marvelous posting! I genuinely enjoyed reading it, you might be a great author.I will
remember to bookmark your blog and definitely will come back sometime
soon. I want to encourage you to continue your great work, have a nice afternoon!

How long do you grow during puberty?   2017/7/28 上午 11:20:00

Good day I am so excited I found your weblog, I really found you by accident, while I was browsing on Digg for
something else, Regardless I am here now and would just like to say
cheers for a incredible post and a all round enjoyable blog
(I also love the theme/design), I don't have
time to look over it all at the minute but I have bookmarked it and also
added in your RSS feeds, so when I have time I will be back to read much more, Please do keep up the excellent

Where are the femur tibia and fibula?   2017/7/22 上午 11:25:00

Thanks on your marvelous posting! I actually enjoyed reading it, you're a great author.
I will always bookmark your blog and will often come back in the future.
I want to encourage you to ultimately continue your great posts,
have a nice evening!

foot pain at night   2017/7/4 上午 07:21:00

Hello my family member! I want to say that this post is amazing, nice written and include
almost all important infos. I would like to see more posts like this.

foot pain on top of foot   2017/7/2 上午 10:30:00

Stunning quest there. What happened after? Good luck!

manicure   2017/5/4 上午 05:25:00

Hello There. I found your blog using msn. This is a really well written article.
I will make sure to bookmark it and come back to read more of your useful info.
Thanks for the post. I will definitely return.

manicure   2017/4/11 下午 06:36:00

Have you ever thought about including a little bit more than just your articles?
I mean, what you say is fundamental and all.

But just imagine if you added some great graphics or video clips to give your posts more, "pop"!
Your content is excellent but with images
and video clips, this website could certainly be one of the very best
in its niche. Good blog!

卜維丰   2008/10/22 下午 02:16:00

ballboy, 圖片當然是要在自己主機上才能處理囉~~^^

ballboy   2008/10/13 下午 02:42:00

而是在遠端 ex.flick
這有支援嗎? 還是程式要怎樣改?


卜維丰   2008/6/18 下午 12:05:00



進化中的人類   2008/6/18 上午 11:00:00


二姐   2007/12/3 下午 12:32:00


  如果您是要發問問題, 最好有個問題測試的網址, 這樣比較容易找到您問題所在, 謝謝