Skip to content
Skip to search - Accesskey = s
parentNode.org
The building blocks of a solid frontend.
Pasted
by
ImageObject
on
2007-08-02 12:55
as
Plain Text
Create New
http://pastebin.parentnode.org/
Links this one
http://pastebin.parentnode.org/19953
Comment
<?php class ImageObject { private $imageFilePath; private $source; private $newImage; private $imageWidth; private $imageHeight; private $thumb; public function ImageObject($myImage) { $this->imageFilePath = $myImage; $this->source = $this->getSourceImage(); list($width, $height) = getimagesize($this->imageFilePath); $this->imageWidth = $width; $this->imageHeight = $height; } public function shrink($maxWidth, $maxHeight) { private function getSourceImage() { public function output($destination) { private function getBiggestSmallestSides() { private function getNewSize($maxWidth, $maxHeight) { public function generateThumb($width, $height) { //check if the image is too big if($this->imageWidth > $width || $this->imageHeight > $height) { //set cropWidth & height $cropWidth = $this->imageWidth - $width; $cropHeight = $this->imageHeight - $height; //set starting x & y positions for cropping $x = $cropWidth / 2; $y = $cropHeight / 2; //create blank image to put the new thumb on $this->newImage = imagecreatetruecolor($width, $height); //copy the thumb to to imagecopyresampled($this->newImage, $this->source, 0, 0, $x, $y, $width, $height, $this->imageWidth, $this->imageHeight); } else { return; } } public function destroy() { } ?>