src/SpeedUpEssentials/Helper/Spritify.php
private function create_image() {
        $total = $this->total_size();
        $sprite = imagecreatetruecolor($total["width"], $total["height"]);
        imagesavealpha($sprite, true);
        $transparent = imagecolorallocatealpha($sprite, 0, 0, 0, 127);
        imagefill($sprite, 0, 0, $transparent);
        $top = 0;
        foreach ($this->images as $image) {
            $func = "imagecreatefrom" . $image['type'];
            $img = $func($image["path"]);
            imagecopy($sprite, $img, ($total["width"] - $image["width"]), $top, 0, 0, $image["width"], $image["height"]);
            $top += $image["height"];
        }
        return $sprite;
    }
private function create_image() {
        $total = $this->total_size();
        $sprite = imagecreatetruecolor($total["width"], $total["height"]);
        imagesavealpha($sprite, true);
        $transparent = imagecolorallocatealpha($sprite, 0, 0, 0, 127);
        imagefill($sprite, 0, 0, $transparent);
        $top = 0;
        foreach ($this->images as $image) {
            $func = "imagecreatefrom" . $image['type'];
            $img = $func($image["path"]);
            imagecopy($sprite, $img, ($total["width"] - $image["width"]), $top, 0, 0, $image["width"], $image["height"]);
            $top += $image["height"];
        }
        return $sprite;
    }
creates sprite image resource