Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93218021
PHUIImageMaskExample.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 27, 02:45
Size
2 KB
Mime Type
text/x-php
Expires
Fri, Nov 29, 02:45 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22592977
Attached To
rPH Phabricator
PHUIImageMaskExample.php
View Options
<?php
final
class
PHUIImageMaskExample
extends
PhabricatorUIExample
{
public
function
getName
()
{
return
'Image Masks'
;
}
public
function
getDescription
()
{
return
'Display images with crops.'
;
}
public
function
renderExample
()
{
$image
=
celerity_get_resource_uri
(
'/rsrc/image/examples/hero.png'
);
$display_height
=
100
;
$display_width
=
200
;
$mask1
=
id
(
new
PHUIImageMaskView
())
->
addClass
(
'ml'
)
->
setImage
(
$image
)
->
setDisplayHeight
(
$display_height
)
->
setDisplayWidth
(
$display_width
)
->
centerViewOnPoint
(
265
,
185
,
30
,
140
);
$mask2
=
id
(
new
PHUIImageMaskView
())
->
addClass
(
'ml'
)
->
setImage
(
$image
)
->
setDisplayHeight
(
$display_height
)
->
setDisplayWidth
(
$display_width
)
->
centerViewOnPoint
(
18
,
18
,
40
,
80
);
$mask3
=
id
(
new
PHUIImageMaskView
())
->
addClass
(
'ml'
)
->
setImage
(
$image
)
->
setDisplayHeight
(
$display_height
)
->
setDisplayWidth
(
$display_width
)
->
centerViewOnPoint
(
265
,
185
,
30
,
140
)
->
withMask
(
true
);
$mask4
=
id
(
new
PHUIImageMaskView
())
->
addClass
(
'ml'
)
->
setImage
(
$image
)
->
setDisplayHeight
(
$display_height
)
->
setDisplayWidth
(
$display_width
)
->
centerViewOnPoint
(
18
,
18
,
40
,
80
)
->
withMask
(
true
);
$mask5
=
id
(
new
PHUIImageMaskView
())
->
addClass
(
'ml'
)
->
setImage
(
$image
)
->
setDisplayHeight
(
$display_height
)
->
setDisplayWidth
(
$display_width
)
->
centerViewOnPoint
(
254
,
272
,
60
,
240
)
->
withMask
(
true
);
$box1
=
id
(
new
PHUIObjectBoxView
())
->
setHeaderText
(
pht
(
'Center is in the middle'
))
->
appendChild
(
$mask1
);
$box2
=
id
(
new
PHUIObjectBoxView
())
->
setHeaderText
(
pht
(
'Center is on an edge'
))
->
appendChild
(
$mask2
);
$box3
=
id
(
new
PHUIObjectBoxView
())
->
setHeaderText
(
pht
(
'Center Masked'
))
->
appendChild
(
$mask3
);
$box4
=
id
(
new
PHUIObjectBoxView
())
->
setHeaderText
(
pht
(
'Edge Masked'
))
->
appendChild
(
$mask4
);
$box5
=
id
(
new
PHUIObjectBoxView
())
->
setHeaderText
(
pht
(
'Wide Masked'
))
->
appendChild
(
$mask5
);
return
phutil_tag
(
'div'
,
array
(),
array
(
$box1
,
$box2
,
$box3
,
$box4
,
$box5
,
));
}
}
Event Timeline
Log In to Comment