Blog Sections Open

Fixing DirectResize 0.8 for PHP 5.3

A compatibility patch for older DirectResize installations that relied on ereg-style functions removed from modern PHP runtimes.

Older Evolution CMS projects often depended on utilities that were written for a different PHP era. One common example was DirectResize 0.8, which used ereg_replace and eregi_replace.

When PHP 5.3 and later environments became more common, these calls started to cause avoidable breakage. The fix was straightforward: replace the old regex functions with preg_replace().

Typical replacements

$imgHTMLHeight = preg_replace("/[^0123456789]/", "", $array[0]);
$imgHTMLWidth = preg_replace("/[^0123456789]/", "", $array[0]);

$currentImgPath = preg_replace("/^.+src=('|")/i", "", $imgs[0][$n]);
$currentImgPath = preg_replace("/('|").*$/i", "", $currentImgPath);

$tmp = preg_replace("/" . $attr_k . " *= *["|']/i", "", $array[0]);
$tmp = preg_replace("/["']*/i", "", $tmp);

Why this matters

These updates are small, but they are typical of real maintenance work in legacy CMS projects. The most useful fixes are often not architectural rewrites. They are tiny, targeted compatibility patches that keep trusted tools working long enough for a more deliberate replacement plan.

If you inherit an older project and see broken resizing code, search first for deprecated PHP functions before you assume the whole component is beyond repair.

Newer post

Fixing TinyMCE Anchor Links That Jump to the Home Page

A small manager-side fix for TinyMCE anchor links so in-page anchors point to the current resource URL instead of unexpectedly dropping visitors onto the homepage.

Older post

Showing menutitle Instead of pagetitle in the Manager Tree

A small manager tweak for projects where long page titles make the resource tree hard to scan and a shorter menu title is easier to work with.