How do you make your own portrait from a photo?

Source: Internet
Author: User

<BODY>
<style>
#tbHole Td{background:white;filter:alpha (opacity=50);-moz-opacity:.5}
#tbHole Img{width:1;height:1;visibility:hidden}
V\:* {behavior:url (#default #vml)}
</style>
<div Id=bxhole Onselectstart=return (False) Ondragstart=return (false) Onmousedown=return (false) oncontextmenu= Return (false) style= "position:absolute;left:0;top:0;width:800;height:600;border:1px solid #808080; Background:url ( HTTP://ALBUM.SINA.COM.CN/PIC/40DB9AAA02000EH1) ">
<table id=tbhole cellpadding=0 cellspacing=0 width=100% height=100%
<tr HEIGHT=158&GT;&LT;TD WIDTH=243&GT;&LT;IMG&GT;&LT;/TD&GT;&LT;TD WIDTH=120&GT;&LT;IMG&GT;&LT;/TD&GT;&LT;TD ></td></tr>
<tr height=140>
<td></td>
<td onmousedown=$ (' Bxhole '). DragStart (event,0) style= "Background:transparent;filter:;-moz-opacity:1;cursor: move;border:1px solid white!important "></td>
<td></td>
</tr>
<tr><td></td><td></td><td></td>< /tr>
</table>




</div>
<div id=bximgholeshow style= "position:absolute;left:850;top:50;width:120;height:140;border:1px solid #808080; o Verflow:hidden "></div>
</BODY>

<script>
function $ (obj) {
Return typeof (obj) = = "Object"? Obj ":d Ocument.getelementbyid (obj)
}
Bxhole_ini ()
function Bxhole_ini () {
var bx=$ ("Bxhole"), tb=$ ("Tbhole")
$ ("Bximgholeshow"). Innerhtml= "<" + (document.all?) V:image ":" img ") +" Id=imgholeshow src= ' http://album.sina.com.cn/pic/40db9aaa02000eh1 ' style= ' position:absolute; left:0;top:0;width:800;height:600 '/> '
Bx.w0=tb.rows[0].cells[1].offsetwidth
Bx.h0=tb.rows[1].offsetheight
bx.w_img=$ ("Imgholeshow"). offsetwidth
bx.h_img=$ ("Imgholeshow"). offsetheight
Bx.dragstart=function (E,dragtype) {
Bx.dragtype=dragtype
Bx.px=tb.rows[0].cells[0].offsetwidth
Bx.py=tb.rows[0].offsetheight
Bx.pw=tb.rows[0].cells[1].offsetwidth
Bx.ph=tb.rows[1].offsetheight
Bx.sx=e.screenx
Bx.sy=e.screeny
}
Bx.onmouseup=function () {
if (bx.dragtype==null)
Return
var w=tb.rows[0].cells[1].offsetwidth,h=tb.rows[1].offsetheight
Bx.dragtype=null
if (w/h>bx.w0/bx.h0)
Tb.rows[0].cells[1].style.width=h*bx.w0/bx.h0
Else
Tb.rows[1].style.height=w*bx.h0/bx.w0
Bx.settip ()
}
Bx.onmousemove=function (e) {
var x,y,w,h
if (bx.dragtype==null)
Return
if (e==null)
E=event
X=math.max (bx.px+e.screenx-bx.sx,1)
Y=math.max (bx.py+e.screeny-bx.sy,1)
W=math.min (bx.pw+e.screenx-bx.sx,tb.offsetwidth-bx.px-1)
H=math.min (bx.ph+e.screeny-bx.sy,tb.offsetheight-bx.py-1)
if (bx.dragtype==0) {
X=math.min (x,tb.offsetwidth-bx.pw-1)
Y=math.min (y,tb.offsetheight-bx.ph-1)
W=bx.pw
h=bx.ph
}
if (bx.dragtype==1| | BX.DRAGTYPE==4)
W=bx.pw+bx.px-x
if (bx.dragtype==1| | bx.dragtype==2)
H=bx.ph+bx.py-y
if (bx.dragtype==2| | BX.DRAGTYPE==3)
X=bx.px
if (bx.dragtype==3| | BX.DRAGTYPE==4)
y=bx.py
W=math.max (W,BX.W0/2)
H=math.max (H,BX.H0/2)
if (bx.dragtype==1| | BX.DRAGTYPE==4)
X=bx.pw+bx.px-w
if (bx.dragtype==1| | bx.dragtype==2)
Y=bx.ph+bx.py-h
Tb.rows[0].cells[0].style.width=x
Tb.rows[0].cells[1].style.width=w
Tb.rows[0].style.height=y
Tb.rows[1].style.height=h
$ ("Bxhole"). Settip ()
}
Bx.settip=function () {
var x=tb.rows[0].cells[0].offsetwidth,y=tb.rows[0].offsetheight,w=tb.rows[0].cells[1].offsetwidth,h=tb.rows[1]. Offsetheight
var img=$ ("Imgholeshow"), per
$ ("bxHoleMove1"). style.left=$ ("BxHoleMove4"). style.left=x-3
$ ("bxHoleMove1"). style.top=$ ("BxHoleMove2"). style.top=y-3
$ ("BxHoleMove2"). style.left=$ ("BxHoleMove3"). style.left=x+w-4
$ ("BxHoleMove3"). style.top=$ ("BxHoleMove4"). style.top=y+h-4

if (w/h>bx.w0/bx.h0)
W=h*bx.w0/bx.h0
Else
H=w*bx.h0/bx.w0
per=bx.h0/h
Img.style.width=per*bx.w_img
Img.style.height=per*bx.h_img
Img.style.left=-x*per
Img.style.top=-y*per
}
Bx.settip ()
}
</script>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.