Skip to content

AddImage using value from PHP Object #2285

Open
@Artoo23

Description

@Artoo23

Describe the Bug

I am trying to create a word document using data from the Trello API.

The API can provide a partial URL for an avatar image. The full image URL can be derived from this by adding on details of the image size.

So the API provides something like this

"avatarUrl": "https://trello-members.s3.amazonaws.com/6059dd69783e1b38da09a50c/acdc216e9c555d2f9a9a5aaf6183775f"

and the full URL is

"https://trello-members.s3.amazonaws.com/6059dd69783e1b38da09a50c/acdc216e9c555d2f9a9a5aaf6183775f/50.png".

Whenever i try to use the object value to derive the image URL and use this in an addImage call I get a 500 error.

Steps to Reproduce

I my addImage call is in a foreach loop where I iterate through card members.

		foreach ($members as $member) {
					
		$imageStyle = array(
			'width' => 40,
			'height' => 40,
			'wrappingStyle' => 'square',
			'positioning' => 'absolute',
			'posHorizontalRel' => 'margin',
			'posVerticalRel' => 'line',
		);

		$section->addImage($member->avatarUrl . "/50.png", $imageStyle);
	
		}

Expected Behavior

PHPWord recognises the image URL and adds image to document

Current Behavior

500 Internal Server Error

Context

Please fill in your environment information:

  • PHP Version: 7.2.34
  • PHPWord Version: 0.18.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions