Hi all,
I've been trying to figure out a long time how to change this:
$dString = 'placeholder<br><img src="tempRemoved/ftpstart.png" alt="FTP Start Size is 738 x 153" width="738" height="153"><br>';
into this:
placeholder<br><img src="${1}" alt="demo" width="150" height="100"><br>
where ${1} is the same src as the previous, just the rest of the tags are modified. This script is to do a mass edit on the database where the width and height are too big for my layout.
I tried:
$pattern = '/<img src="([a-zA-Z0-9]+\/?)+\.?">/';
$replacement = '<img src="${1}" alt="demo" width="150" height="100">';
$newString = preg_replace($pattern, $replacement, $dString);
I only need the PREG_REPLACE pattern, I know I'm not using any kind of algorithm to compute the new scale. This is just a demo. Just can't get the PATTERN to work right 🙁
Would appreciate the help, thanks 🙂