I'm studying DOMpdf. I can display images but when I add if else statement the function doesn't work and I always got this error image.
@if ($student->w2c = '')
no image.
@else
// w2c is ture or false alwasy got error image as attach file
<img src="data:image/png;base64, {{ $w2_img }}" width="100%"
class="img-thumbnail">
@endif
but somehow same PDF generate blade file not image if else statement works fine.
@if ($student->br = 'area1')
area1 info
@elseif ($student->br = 'area2')
area2 info
@else
-
@endif
Could someone teach me please?
You need to use == or === when you compare the values. It should be:
@if ($student->w2c == '')
no image.
@else
// w2c is ture or false alwasy got error image as attach file
<img src="data:image/png;base64, {{ $w2_img }}" width="100%"
class="img-thumbnail">
@endif
Reference more https://www.php.net/manual/en/language.operators.comparison.php