rasterize() public static method

Uses phantomjs to save the SVG as a PNG image at the specified size.
public static rasterize ( string $file, string $dest, integer $columns, integer $rows )
$file string The path to the file that should be rasterized.
$dest string The path to the directory where the output PNG should be saved.
$columns integer The number of columns in the output image. 0 = maintain aspect ratio based on $rows.
$rows integer The number of rows in the output image. 0 = maintain aspect ratio based on $columns.
Example #1
0
                $image->smartResize($w, 0, true);
                $image->writeImage($path_raster_o . '/' . $base . '-w' . $w . '.' . $ext);
                echo "OK\n";
            }
        }
    }
}
// rasterize SVGs
if ($dir = opendir($path_svg_i)) {
    while (($file = readdir($dir)) !== false) {
        $base = pathinfo($file, PATHINFO_BASENAME);
        $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
        if ($ext === 'svg') {
            foreach ($widths as $w) {
                echo 'Rasterizing ' . $file . ' to ' . $w . '…';
                Respimg::rasterize($path_svg_i . '/' . $file, $path_svg_o . '/', $w, 0);
                echo "OK\n";
            }
        }
    }
}
// copy SVGs
if ($dir = opendir($path_svg_i)) {
    while (($file = readdir($dir)) !== false) {
        $base = pathinfo($file, PATHINFO_BASENAME);
        $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
        if ($ext === 'svg') {
            echo 'Copying ' . $file . '…';
            copy($path_svg_i . '/' . $file, $path_svg_o . '/' . $file);
            echo "OK\n";
        }