Over a million developers have joined DZone.

Change Image Properties 'On-The-Fly'

DZone's Guide to

Change Image Properties 'On-The-Fly'

· ·
Free Resource

 Sometimes you may need to change image properties 'on-the-fly'. The best example is when you want to display blog post short description, retrieve the first image and try to turn it into the thumbnail: change some properties and add a special class name.

 ]+>/i', $postText, $images);
$postThumbnail = isset($images[0][0]) ? $images[0][0] : '';
$postThumbnail = preg_replace('/(width|height|style)="*"/', '', $postThumbnail);
$postThumbnail = preg_replace('/

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}