Denise Field
Denise Field

Reputation: 171

Showing an error when I tried to echo out an image inside a string

I am getting an unexpected T string parse error, I don't know how to incorporate php into this itemprop, can anyone help

$str_policy_details .= '<img itemprop="image" src="data:image/jpeg;base64,<?php echo base64_encode($broker_details->BrokerImage); ?>"/>';

Upvotes: 0

Views: 21

Answers (1)

Praveen Kumar Purushothaman
Praveen Kumar Purushothaman

Reputation: 167192

You are using <?php when you are already inside PHP, which causes the issue. Please change your code to:

$str_policy_details .= '<img itemprop="image" src="data:image/jpeg;base64,' . base64_encode($broker_details->BrokerImage) . '"/>';
//-------------------------------------------------------------------------^^^-------------------------------------------^^^^

Upvotes: 2

Related Questions