$image variable gives this code (when echo is used):
<img src="/image.png" width="100" height="147" alt="" class="some_class" />
width,height,srcandclass
attributes can be different.
What should we do:
- remove
widthandheightfrom$image - replace
alt=""withalt="Poster"
Thanks.
I’d use regular expressions to do this.
This method is not dependant on the order of the attributes, which of the some other answers are. Also note that the second regular expressions will replace
alt="<any string here>"withalt="Poster". It should be easy enough to change it to only replacealt=""though.