Just another quick debug task.
That client’s vendor said they spent many hours but still no idea why.
Well, I spent more time on writing this post than actual debugging.
Just another quick debug task.
That client’s vendor said they spent many hours but still no idea why.
Well, I spent more time on writing this post than actual debugging.
I worked on an legacy system running PHP 5.2.6 on Windows and I can’t update it.
With php_zip enabled, PHPExcel loads .xls but still not .xlsx.
When loading a .xlsx, it’s simply die without any error message.
Continue reading “PHPExcel not loading .xlsx in PHP earlier than 5.2.11”
img2table converts JPG/PNG into HTML table to render in browser.
Perhaps the only IE6 compatible embed image (But who cares about IE6 nowadays anyway?)
Perfect way to waste disk space, memory and cpu resources!
The PHP implementation:
<?php $filename = 'original.png'; $pathinfo = pathinfo($filename); if ($pathinfo['extension'] == 'png') { $image = imagecreatefrompng($filename); } else if ($pathinfo['extension'] == 'jpg' || $pathinfo['extension'] == 'jpeg') { $image = imagecreatefromjpeg($filename); } if (!$image) die('Invalid image'); $size = getimagesize($filename); $width = $size[0]; $height = $size[1]; $pixel_size = 16; ?> <table cellpadding="0" cellspacing="0" border="0"> <?php for ($y = 0; $y < $height; $y += 1) { ?> <tr> <?php for ($x = 0; $x < $width; $x += 1) { ?> <td width="<?php echo $pixel_size?>" height="<?php echo $pixel_size?>" style="background-color: #<?php echo str_pad(dechex(imagecolorat($image, $x, $y)), 6, '0', STR_PAD_LEFT);?>"></td> <?php } ?> </tr> <?php } ?> </table>
Result: 252 bytes PNG converted into 18,204 bytes HTML (7223% bigger)
Cool? No… Just a quick idea for fun 😀