Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F977176
PhabricatorImageDocumentEngine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorImageDocumentEngine.php
View Options
<?php
final
class
PhabricatorImageDocumentEngine
extends
PhabricatorDocumentEngine
{
const
ENGINEKEY
=
'image'
;
protected
function
getDocumentIconIcon
(
PhabricatorDocumentRef
$ref
)
{
return
'fa-file-image-o'
;
}
protected
function
canRenderDocumentType
(
PhabricatorDocumentRef
$ref
)
{
$file
=
$ref
->
getFile
();
if
(
$file
)
{
return
$file
->
isViewableImage
();
}
$viewable_types
=
PhabricatorEnv
::
getEnvConfig
(
'files.viewable-mime-types'
);
$viewable_types
=
array_keys
(
$viewable_types
);
$image_types
=
PhabricatorEnv
::
getEnvConfig
(
'files.image-mime-types'
);
$image_types
=
array_keys
(
$image_types
);
return
$ref
->
hasAnyMimeType
(
$viewable_types
)
&&
$ref
->
hasAnyMimeType
(
$image_types
);
}
protected
function
newDocumentContent
(
PhabricatorDocumentRef
$ref
)
{
$file
=
$ref
->
getFile
();
if
(
$file
)
{
$source_uri
=
$file
->
getViewURI
();
}
else
{
// We could use a "data:" URI here. It's not yet clear if or when we'll
// have a ref but no backing file.
throw
new
PhutilMethodNotImplementedException
();
}
$image
=
phutil_tag
(
'img'
,
array
(
'src'
=>
$source_uri
,
));
$linked_image
=
phutil_tag
(
'a'
,
array
(
'href'
=>
$source_uri
,
'rel'
=>
'noreferrer'
,
),
$image
);
$container
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'document-engine-image'
,
),
$linked_image
);
return
$container
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Jun 18, 10:09 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
228218
Default Alt Text
PhabricatorImageDocumentEngine.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment