From 9196bf07a732432089787fe970ec2833c30126bb Mon Sep 17 00:00:00 2001 From: Fabian de Boer Date: Sun, 19 Jul 2026 21:46:08 +0200 Subject: [PATCH] removed log.xml (txt remain) (#22); updated README (#24); achor ZapBase (#23) --- README.md | 4 ++-- conf/init.php | 4 ++-- docs/framework_guide.md | 2 +- lib/ImgTools.class.php | 6 ++---- utils/Log.class.php | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e45046a..a1d4e21 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,12 @@ www.apfab.com Zap stands for 'Zapped Artificial Picture', a collage made from Internet images. A Zap translates a set of words or a text into an image which reflects the visual representation of the words on the Internet. -This web application, Zap Machine, needs a number of words as input. It then takes the most relevant image that search engine Yahoo comes up with. After having collected all images the Zap Machine creates a given number of different collages from those images. +This web application, Zap Machine, needs a number of words as input. It then takes the most relevant image that search engine Brave comes up with. After having collected all images the Zap Machine creates a given number of different collages from those images. ## installation -First you need to run a server with PHP. Please do not use a Windows machine for this purpose, while Windows suck. ApFab recommends Linux or Mac;) +First you need to run a server with PHP. The application is developed and tested on Linux and macOS; Windows is not recommended. ApFab Zap Machine needs some PHP extensions: - JSON (default installed) diff --git a/conf/init.php b/conf/init.php index 717c6f8..f2a6078 100755 --- a/conf/init.php +++ b/conf/init.php @@ -15,7 +15,7 @@ if (!defined('BRAVE_API_KEY')) { /** * Define some app-wide constants */ -define('ZAP_APP_BASE_DIR', realpath('.' . DIRECTORY_SEPARATOR . '..')); +define('ZAP_APP_BASE_DIR', realpath(__DIR__ . DIRECTORY_SEPARATOR . '..')); define('ZAP_WEB_DIR', 'www'); define('ZAP_RESOURCE_DIR', 'resource'); define('ZAP_UTILS_DIR', 'utils'); @@ -104,7 +104,7 @@ function getZAPTemplate($tplname) { if (file_exists($tplfilepath)) { return $tplfilepath; } else { - return ERROR_PREFIX . 'No template'; + throw new Exception(ERROR_PREFIX . 'No template'); } } ?> \ No newline at end of file diff --git a/docs/framework_guide.md b/docs/framework_guide.md index 4bff8d8..4fb7aa6 100644 --- a/docs/framework_guide.md +++ b/docs/framework_guide.md @@ -212,7 +212,7 @@ Key differences from the web entry point: ### Logging -The `Log` class (`utils/Log.class.php`) writes timestamped messages to a session folder. It is used by `ImgSearch` (controlled by the `ZAP_LOG` constant in `conf/conf.php`). Each log call appends to both `log.txt` (plain text) and `log.xml` (XML-friendly) in the session's output directory. +The `Log` class (`utils/Log.class.php`) writes timestamped messages to a session folder. It is used by `ImgSearch` (controlled by the `ZAP_LOG` constant in `conf/conf.php`). Each log call appends to both `log.txt` (plain text) and `log.html` (HTML-friendly) in the session's output directory. ```php if (ZAP_LOG == true) { diff --git a/lib/ImgTools.class.php b/lib/ImgTools.class.php index 995ad9f..e743235 100755 --- a/lib/ImgTools.class.php +++ b/lib/ImgTools.class.php @@ -112,10 +112,8 @@ class ImgTools { $mimeType = $imgInfo['mime']; //find gif if ($mimeType == "image/gif") { - $imagetype = 'png'; - //full image name - $Dot = '.'; - $newFilename = "$filename$Dot$imagetype"; + // Replace .gif extension with .png + $newFilename = preg_replace('/\.gif$/i', '.png', $filename); //convert $img = new Imagick($filename); diff --git a/utils/Log.class.php b/utils/Log.class.php index db162db..3ff120f 100755 --- a/utils/Log.class.php +++ b/utils/Log.class.php @@ -13,7 +13,7 @@ class Log { $this->folder = $imgFolder; $this->logFileName = $imgFolder . DIRECTORY_SEPARATOR . 'log.txt'; - $this->logFileXmlName = $imgFolder . DIRECTORY_SEPARATOR . 'log.xml'; + $this->logFileXmlName = $imgFolder . DIRECTORY_SEPARATOR . 'log.html'; } public function addToLog($type, $head, $addString) {