public function macroImg(MacroNode $node, PhpWriter $writer)
{
$this->isUsed = TRUE;
$arguments = Helpers::prepareMacroArguments($node->args);
if ($arguments["name"] === NULL) {
throw new Nette\Latte\CompileException("Please provide filename.");
}
$namespace = $arguments["namespace"];
unset($arguments["namespace"]);
$arguments = array_map(function ($value) use($writer) {
return $value ? $writer->formatWord($value) : 'NULL';
}, $arguments);
$command = '$_imagePipe';
$command .= $namespace !== NULL ? '->setNamespace(' . $writer->formatWord(trim($namespace)) . ')' : '';
$command .= '->request(' . implode(", ", $arguments) . ')';
return $writer->write('echo %escape(' . $writer->formatWord($command) . ')');
}