[TASK] Enhanced status report.

[TASK] BoxImageClass now has some getters for height and width.
This commit is contained in:
Jan Philipp Timme 2011-01-03 14:48:31 +00:00
parent fea4ee040c
commit 61ea2b936e
2 changed files with 33 additions and 2 deletions

View File

@ -145,4 +145,20 @@ class BoxImage {
return imagepng($this->image, $filename, $compression);
}
/**
* Gets height.
* @return int
*/
public function getHeight() {
return $this->height;
}
/**
* Gets width.
* @return int
*/
public function getWidth() {
return $this->width;
}
}

View File

@ -36,7 +36,11 @@ class FileImageConverter {
$filesize = filesize($filename);
$md5 = md5_file($filename);
$new_filename = $filename."-converted.png";
echo "Processing '" . $filename . "' (" . $filesize . " Bytes) - MD5: " . $md5 . "\n";
$new_filename = basename($filename)."-converted.png";
echo "Filename for the result: '" . $new_filename . "'\n";
//some gradient
$fancy_header = "";
@ -53,9 +57,15 @@ class FileImageConverter {
//create and prepare image
$this->image = new BoxImage($size);
echo "Image will be " . $this->image->getWidth() . "px x " . $this->image->getHeight() . "px.\n";
echo "Filling image...";
$this->image->fillImage(0,0,0,0);
echo "done.\n";
//some fancy header
echo "Adding header...\n";
$this->addDataToImage($fancy_header);
//magic pixel
@ -63,6 +73,7 @@ class FileImageConverter {
$this->image->movePointer(1);
//add filesize
echo "Adding filesize...\n";
$this->addDataToImage($filesize);
//magic pixel
@ -70,6 +81,7 @@ class FileImageConverter {
$this->image->movePointer(1);
//add md5 value of content
echo "Adding MD5-Hash...\n";
$this->addDataToImage($md5);
//magic pixel
@ -77,6 +89,7 @@ class FileImageConverter {
$this->image->movePointer(1);
//content
echo "Adding file contents...\n";
$this->addDataToImage($content);
//magic pixel
@ -84,7 +97,9 @@ class FileImageConverter {
$this->image->movePointer(1);
//save image
echo "Saving image...";
$this->image->writeToFile($new_filename, 9);
echo "done.\n";
//clean up
unset($this->image);
@ -114,7 +129,7 @@ class FileImageConverter {
echo "Caught Exception:\n";
echo $e;
}
echo "\rDone. \n";
echo "\rdone. \n\n";
}
/**