$max = max($max, $row['sheet_x']); $max = max($max, $row['sheet_y']); if (count($row['skin_variations'])) { foreach ($row['skin_variations'] as $row2) { $max = max($max, $row2['sheet_x']); $max = max($max, $row2['sheet_y']); } } } # # bake sheets # create_sheet('apple'); create_sheet('twitter'); create_sheet('google'); create_sheet('emojione'); function create_sheet($type) { $img_w = 64; echo "Creating {$type} : \n"; global $catalog, $max; # # find the replacement glyph for this set # $replacement = null; foreach ($catalog as $row) { if ($row['unified'] == '2753') { $replacement = "img-{$type}-64/{$row['image']}"; } } #
$in = file_get_contents('../emoji.json'); $catalog = json_decode($in, true); # # figure out image extent # $max = 0; foreach ($catalog as $row) { $max = max($max, $row['sheet_x']); $max = max($max, $row['sheet_y']); } # # bake sheets # create_sheet(64, null, $dir . '/../gemoji/images/emoji/unicode/'); create_sheet(72, 'twitter', $dir . '/../img-twitter-72/'); create_sheet(64, 'hangouts', $dir . '/../img-hangouts-64/'); function create_sheet($img_w, $type, $img_path) { global $catalog, $max; $pw = ($max + 1) * $img_w; $ph = ($max + 1) * $img_w; echo "Compositing images ... "; if ($type) { $dst = dirname(__FILE__) . "/../sheet_{$type}_{$img_w}.png"; } else { $dst = dirname(__FILE__) . "/../sheet_{$img_w}.png"; } echo shell_exec("convert -size {$pw}x{$ph} xc:none {$dst}"); foreach ($catalog as $row) { $src = "{$img_path}{$row['image']}"; if (!file_exists($src)) {