Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93293335
ConpherencePicCropControl.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, 16:50
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Nov 29, 16:50 (2 d)
Engine
blob
Format
Raw Data
Handle
22609316
Attached To
rPH Phabricator
ConpherencePicCropControl.php
View Options
<?php
final
class
ConpherencePicCropControl
extends
AphrontFormControl
{
protected
function
getCustomControlClass
()
{
return
'aphront-form-crop'
;
}
protected
function
renderInput
()
{
$width
=
ConpherenceImageData
::
CROP_WIDTH
;
$height
=
ConpherenceImageData
::
CROP_HEIGHT
;
$file
=
$this
->
getValue
();
if
(
$file
===
null
)
{
return
phutil_tag
(
'img'
,
array
(
'src'
=>
PhabricatorUser
::
getDefaultProfileImageURI
(),
),
''
);
}
$c_id
=
celerity_generate_unique_node_id
();
$metadata
=
$file
->
getMetadata
();
$scale
=
PhabricatorImageTransformer
::
getScaleForCrop
(
$file
,
$width
,
$height
);
Javelin
::
initBehavior
(
'aphront-crop'
,
array
(
'cropBoxID'
=>
$c_id
,
'width'
=>
$width
,
'height'
=>
$height
,
'scale'
=>
$scale
,
'imageH'
=>
$metadata
[
PhabricatorFile
::
METADATA_IMAGE_HEIGHT
],
'imageW'
=>
$metadata
[
PhabricatorFile
::
METADATA_IMAGE_WIDTH
],
));
return
javelin_tag
(
'div'
,
array
(
'id'
=>
$c_id
,
'sigil'
=>
'crop-box'
,
'mustcapture'
=>
true
,
'class'
=>
'crop-box'
,
),
array
(
javelin_tag
(
'img'
,
array
(
'src'
=>
$file
->
getBestURI
(),
'class'
=>
'crop-image'
,
'sigil'
=>
'crop-image'
,
),
''
),
javelin_tag
(
'input'
,
array
(
'type'
=>
'hidden'
,
'name'
=>
'image_x'
,
'sigil'
=>
'crop-x'
,
),
''
),
javelin_tag
(
'input'
,
array
(
'type'
=>
'hidden'
,
'name'
=>
'image_y'
,
'sigil'
=>
'crop-y'
,
),
''
),
));
}
}
Event Timeline
Log In to Comment