* Fix open redirect security issue (CWE-601).
You have to white-list allowed default URLs now.
+ * Add support for .svg source files
2012-08-27 Christian Weiske <cweiske@bogo>
1. Put images in ``raw/`` folder.
Name has to be email address + image file extension, for example
- Surrogator supports ``.png`` and ``.jpg``.
+ Surrogator supports ``.png``, ``.jpg`` and ``svg`` files.
For OpenIDs, use the url-encoded URL + extension as filename, for example
replace ``/`` with ``%2F``.
when the raw file is newer than the "square" file in the var folder.
You can force the update with ``--force``.
+Note: PHP imagick extension is required for ``svg`` files.
+
====
Test
} else {
$fileInfos = new \RegexIterator(
new \DirectoryIterator($rawDir),
- '#^.+\.(png|jpg)$#'
+ '#^.+\.(png|jpg|svg|svgz)$#'
);
}
foreach ($fileInfos as $fileInfo) {
$imgOrig = imagecreatefrompng($origPath);
} else if ($ext == 'jpg' || $ext == 'jpeg') {
$imgOrig = imagecreatefromjpeg($origPath);
+ } else if ($ext == 'svg' || $ext == 'svgz') {
+ $imagickImg = new \Imagick();
+ $imagickImg->setBackgroundColor(new \ImagickPixel('transparent'));
+ $imagickImg->readImage($origPath);
+ $imagickImg->setImageFormat('png32');
+ $imgOrig = imagecreatefromstring($imagickImg->getImageBlob());
} else {
//unsupported format
+ logErr('Unsupported image format: ' . $origPath);
return false;
}