0 votes
in SoSci Survey (English) by s151659 (160 points)
edited by SoSci Survey

Hello,

Is it possible to specify data about an image that's added to a box created with pgContent.
For Example, when using:

add(image('test.png'),
    ['x' => 60, 'y' => 40, 'width' => 100]);

the Image is shown at the specified place with the set width, but it's not working in this case:

$page = pgContent('Test');
addToBox(
    $page,
   (image('skala.png'),
    ['x' => 60, 'y' => 40, 'width' => 100]
);

Thank you very much!

1 Answer

0 votes
by SoSci Survey (327k points)
edited by SoSci Survey

That is a good question, and I will make a note to find a solution for that. Or at least a good answer why that is not possible. I am currently thinking about relative positioning and if that might pose a problem...

For the moment, this workaround should work:

$page = pgContent('Test');
addToBox(
    $page,
    box(
        image('skala.png'),
        ['x' => 60, 'y' => 40, 'width' => 100]
    )
);

However, if you are working with floating elements and relative positions, then it won't probably solve your problem?!

Update

After a detailed analysis, I can confirm that there is a systemtic limitation that disallows for using settings within addToBox().

Such settings can only be applied to the elements that are added. When using add() with settings, a box() will implicitly be added around the content. This box will then carry the settings. Therefore the above mentioned workaround is one official solution. The other is even more simple: Many elements can carry settings themselves.

$page = pgContent('Test');
addToBox(
    $page,
    image('skala.png', [
      'x' => 60,
      'y' => 40,
      'width' => 100
    ])
);
by SoSci Survey (327k points)
Please note the update to this question.

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...