0104 | ปุ่มอัพโหลดรูปเข้า upic.me ด่วนทันใจ

Sunday, July 11th, 2010 Posted in PHP Coding, Web Server | 128 Comments »

คุณสมบัติ

– upload รูปได้ทุก format ที่ upic.me รองรับ ขนาดใหญ่ได้ถึง 2MB
– เลือกอัพได้ทีละหลายๆ รูปเหมือนหน้าแรก upic.me ด้วย
– มีสถานะการ upload ขึ้นตลอดการอัพ และจะหายไปเองเมื่ออัพเสร็จ
– อัพเสร็จ code ขึ้นในกล่องข้อความทันที ไม่ต้องก๊อปวาง
– ปรับแต่งหน้าตา สีสันของปุ่มได้ตามสะดวก (ส่วนแก้ไขข้อความ จะทำ version ถัดไปครับ)
– เอาไปใช้กันได้ฟรีๆ ไม่ต้องแปะ link กลับ ไม่ต้องแปะเครดิตใดๆ ทั้งสิ้น
– ไม่เปลือง bandwidth ของ host ด้วย เพราะอัพตรงเข้ามาที่ server ของ upic.me เลย

ถ้างงยังไงลองดูตัวอย่าง code ด้านล่างได้เลยครับ

<script type="text/javascript" src="http://upic.me/js/embedupload.js"></script>
<script type="text/javascript">
upic_target = "targetelement";
upic_type = "resulttype";
upic_buttoncss += "appendcss";
</script>

upic_target => จะให้เอา code ไปแปะที่ช่องไหน
upic_type => รูปแบบ code ที่แปะ มี htmlfull / htmlthumb / bbfull / bbthumb (ถ้าไม่ระบุ จะถือว่าเป็น bbthumb ครับ)
upic_buttoncss => css เสริมสำหรับข้อความในปุ่ม เผื่ออยากแก้สีแก้รูปแบบ ใส่ไปได้เลยครับ (การใส่สี รองรับ code แบบ #abcdef เท่านั้นนะครับ)

ส่วน uploadprogress จะมีประมาณนี้ครับ

<style type="text/css">
#upic_uploader{}
#upic_uploadprogress{}
.progressWrapper{margin-top:5px;}
.progressContainer{border-bottom:1px dotted #ddd;padding:2px;}
.progressName{text-align:left;color:black;margin-left:2px;float:left;}
.progressBarStatus{color:#666;text-align:right;margin:1px 1px 0 0;font-size:9px;}
.red{border:solid 1px #B50000;background-color:#FFEBEB;}
.green{border:solid 1px #DDF0DD;background-color:#EBFFEB;}
.blue{border:solid 1px #CEE2F2;background-color:#F0F5FF;}
.progressBarInProgress,.progressBarComplete,.progressBarError{clear:both;font-size:0;width:0%;height:2px;background-color:blue;margin-top:4px;}
.progressBarComplete{width:100%;background-color:green;visibility:hidden;}
.progressBarError{width:100%;background-color:red;visibility:hidden;}
</style>

(พอดีมันผ่าน compressor มาหลายรอบ code เลยดูยากหน่อย ขออภัยด้วยครับ)
ถ้าอยากแก้ไขหน้าตาสีสันยังไง สามารถ copy code ด้านบนไปแก้ไข แล้วใส่ต่อจาก script ได้เลยครับ

Read the rest of this entry »

Tags: , ,

0097 | upic.me Geolocation Search API

Tuesday, April 13th, 2010 Posted in Misc | 5 Comments »

All APIs are returned in json format. No authentication is required but some api requests are cached so there may have some duplicate result during time.

API URL: http://upic.me/api.geolocation.php

parameters:
– lat : float => latitude (cannot be 0) min -90 max 90
– lng : float => longitude (cannot be 0) min -180 max 180

result:

array(
    "result" : string => 'success', 'empty', 'error',
    "count" : int => number of result found (only for result = 'success')
    "images" : array(
        array(
            "md5id" : string(32),
            "url" : string,
            "thumbnail" : string,
            "distance" : float,
            "lat" : float,
            "lng" : float,
        ),
        array(
            "md5id" : string(32),
            "url" : string,
            "thumbnail" : string,
            "distance" : float,
            "lat" : float,
            "lng" : float,
        ),
        ...
    )
    "message" : string => only if error occurred
)

Tags: ,