使用略述:
一 雙點擊此 droplet,選取圖檔;或,把一個圖檔拖放在此 droplet 上。
二 兩個小圖檔會產生在桌面上,其一的 icon 為圖檔內容,檢視效果用;其二、檔名以 "noRt" 開首,繼之以一組 8 位數目字,及綴以該檔格式的小圖檔才是符合冰果室要求,上傳用。
三 此 droplet 只按比例縮小原圖檔,如欲一 80 x 80 像素的小圖檔,可先用 iPhoto 裁切一個正方形的圖檔。
可自行編譯以下指令,儲存為 application;或在小弟的 iDisk 內下載 TIG.dmg。
http://homepage.mac.com/cherish/FileSharing1.html
代碼: 選擇全部
property thumbsize : 80
property fileTypeList : {"JPEG", "TIFF", "GIFf", "PICT", "QTIF"}
property fileTEList : {".jpg", ".tif", ".gif", ".pct", ".qtif"}
property extensionList : {".jpg", ".jpeg", ".tif", ".tiff", ".gif", ".pict", ".pct", ".qtif"}
-- if someone double click this droplet
-- it will ask for the image file
on run
set imageOri to (choose file with prompt "where is the image?")
resizeImage(imageOri)
end run
--when a image is being droped on this droplet
-- the dropped file
on open theFile
set imageOri to item 1 of theFile
resizeImage(imageOri)
end open
on resizeImage(theImage)
tell application "Finder"
try
set theFileType to (file type of theImage) as string
on error
set theFileType to ""
end try
set theFileName to name of item theImage
end tell
set itsAnImage to false
if theFileType is in fileTypeList then set itsAnImage to true
repeat with i in extensionList
if theFileName ends with i then
set itsAnImage to true
set imageExt to i
else
repeat with i from 1 to count of fileTypeList
if theFileType = item i of fileTypeList then
set imageExt to item i of fileTEList
end if
end repeat
end if
end repeat
set thumbName to "t" & (random number from 10000000 to 99999999)
set thumbPath to (path to desktop folder as string) & thumbName & imageExt
try
tell application "Image Capture Scripting"
set newThumb to open theImage
scale newThumb to size thumbsize
save newThumb in file thumbPath
close newThumb
end tell
end try
try
do shell script "cp ~/Desktop/" & thumbName & imageExt & " ~/Desktop/noR" & thumbName & imageExt
end try
end resizeImage
