Core::make('html/image', array(File::getByID($item['fID'])))->getTag() question

Permalink 1 user found helpful
Hello!
I'm create custom block type.
In form.php (for edit.php and add.php) i write
Core::make('html/image', array(File::getByID($item['fID'])))->getTag()
and i get code:

<picture><!--[if IE 9]><video style='display: none;'><![endif]--><!--[if IE 9]></video><![endif]--><img src="URL_TO_IMAGE" alt="#"></picture>

And all right. That's what i need.

But if I write the same code in controller.php i get
<img src="URL_TO_IMAGE" alt="2.jpg" width="1440" height="900">


The same function is performed differently. (form.php and view.php vs controller.php)
My controller.php start code
<?php
namespace Application\Block\Amgallery;
use Concrete\Core\Block\BlockController;
use Loader;
use Core;
use Database;
use File;
use Image;
use Concrete\Core\Editor\LinkAbstractor;
defined('C5_EXECUTE') or die(_("Access Denied."));
class Controller extends BlockController
{
    protected $btTable = "btAmgallery";
    protected $btInterfaceWidth = "350";
    protected $btInterfaceHeight = "290";


and view и edit assets:
$this->requireAsset('core/file-manager');

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi antonovsky,

What is the code you are using to generate the image in your controller file? In the html/image service, the second parameter is an array. You may be passing false as the second element in this array.

Example: make a picture tag
Core::make('html/image', array(File::getByID($item['fID'])))->getTag();

Example: make an img tag using false
Core::make('html/image', array(File::getByID($item['fID']), false))->getTag();

http://documentation.concrete5.org/api/class-Concrete.Core.Html.Ima...
antonovsky replied on at Permalink Reply
in controller.php i use code:
Core::make('html/image', array(File::getByID($fID)))->getTag();

It genereta img tag:
<img src="/application/files/5714/5686/3380/2.jpg" alt="2.jpg">

How to generate picture tag in controller.php?
MrKDilkington replied on at Permalink Reply
MrKDilkington
@antonovsky

What is the full code in your controller?
antonovsky replied on at Permalink Reply
https://github.com/antonovsky/amgallery/blob/master/amgallery/controller.php
MrKDilkington replied on at Permalink Reply
MrKDilkington
@antonovsky

As hissy mentioned, do you have getThemeResponsiveImageMap() in your page_theme.php?

Example:
https://github.com/concrete5/concrete5/blob/develop/web/concrete/the...
antonovsky replied on at Permalink Reply
I do not know. I think it has. I use a basic theme of concrete 5. Elemental. Last version of concrete5. Concrete5 is installed without demo data.
antonovsky replied on at Permalink Reply
Please help me. I have getThemeResponsiveImageMap in Elemental theme.
hissy replied on at Permalink Reply
hissy
Your theme should support responsive image map. See:
http://documentation.concrete5.org/developers/designing-for-concret...