public function resize() { if ($this->valid != ImageAsset::checksum($this->Image->id, $this->parameters)) { header('HTTP/1.1 401 Unauthorized'); die('<h1>Not Authorized</h1>'); } do_action('shopp_imageserver_preprocess', $this->Image, $this->parameters); $Resized = new ImageProcessor($this->Image->retrieve(), $this->Image->width, $this->Image->height); $scaled = $this->Image->scaled($this->width, $this->height, $this->scale); $alpha = 'image/png' == $this->Image->mime; if (-1 == $this->fill) { $alpha = true; } $Resized->scale($scaled['width'], $scaled['height'], $this->scale, $alpha, $this->fill); // Post sharpen if (!$alpha && $this->sharpen > 0) { $Resized->sharpen($this->sharpen); } $ResizedImage = new ImageAsset(); $ResizedImage->copydata($this->Image, false, array()); $ResizedImage->name = 'cache_' . implode('_', $this->parameters); $ResizedImage->filename = $ResizedImage->name . '_' . $ResizedImage->filename; $ResizedImage->parent = $this->Image->id; $ResizedImage->context = 'image'; $ResizedImage->mime = 'image/jpeg'; $ResizedImage->id = false; $ResizedImage->width = $Resized->width(); $ResizedImage->height = $Resized->height(); $ResizedImage->settings = $this->parameters; do_action('shopp_imageserver_processed', $ResizedImage, $this->parameters); $ResizedImage->data = $Resized->imagefile($this->quality); if (empty($ResizedImage->data)) { return false; } $ResizedImage->size = strlen($ResizedImage->data); $this->Image = $ResizedImage; if (false === $ResizedImage->store($ResizedImage->data)) { return false; } $ResizedImage->save(); }