<?php
$dir = __DIR__;
require ($dir . '/src/XF.php');
XF::start($dir);
$app = XF::setupApp('XF\Pub\App');
for ($i = 1 ; $i <= 500; $i++)
{
$addOnId = 'TestAddOn' . $i;
$tempFile = \XF\Util\File::getTempFile();
$path = \XF::getAddOnDirectory() . '/' . $addOnId . '/icon.png';
\XF\Util\File::copyFile($path, $tempFile, false);
clearstatcache(); // older PHP versions appear to cache the 0 byte size when the file was created
$imageManager = \XF::app()->imageManager();
$image = $imageManager->imageFromFile($tempFile);
$uri = $image ? $image->getDataUri($tempFile) : null;
if ($uri)
{
echo '<img src="' . $uri . '" style="width: 64px" /><br /><br />';
}
}
\XF::dump(number_format(microtime(true) - $app['time.granular'], 4));