feat: add document options `is_image`
This commit is contained in:
parent
732464e123
commit
22a14b956a
|
@ -719,10 +719,8 @@ class Item extends Entity {
|
|||
|
||||
if ( $document_options && isset($document_options['forced_iframe']) && $document_options['forced_iframe'] === true ) {
|
||||
|
||||
$headers = get_headers($url, 1);
|
||||
|
||||
// URL points to an image file
|
||||
if (strpos($headers['Content-Type'], 'image/') !== false) {
|
||||
if (isset($document_options['is_image']) && $document_options['is_image'] === true) {
|
||||
$_embed = sprintf('<a href="%s" target="blank"><img src="%s" /></a>', $url, $url);
|
||||
|
||||
// URL points to a content that is not an image
|
||||
|
|
|
@ -117,6 +117,13 @@ class Items extends Repository {
|
|||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'default' => false
|
||||
),
|
||||
'is_image' => array(
|
||||
'title' => __( 'Is link to external image', 'tainacan' ),
|
||||
'description' => __( 'Is link to external image', 'tainacan' ),
|
||||
'type' => 'boolean',
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'default' => false
|
||||
),
|
||||
'forced_iframe_height' => array(
|
||||
'description' => __( 'Iframe height (px)', 'tainacan' ),
|
||||
'type' => 'number',
|
||||
|
|
Loading…
Reference in New Issue