diff --git a/BoxImage.class.php b/BoxImage.class.php index c0f8778..9f5ba99 100644 --- a/BoxImage.class.php +++ b/BoxImage.class.php @@ -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; + } + } \ No newline at end of file diff --git a/FileImageConverter.class.php b/FileImageConverter.class.php index abff297..f46b754 100644 --- a/FileImageConverter.class.php +++ b/FileImageConverter.class.php @@ -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"; } /**