removed log.xml (txt remain) (#22); updated README (#24); achor ZapBase (#23)

This commit is contained in:
Fabian de Boer 2026-07-19 21:46:08 +02:00
commit 9196bf07a7
5 changed files with 8 additions and 10 deletions

View file

@ -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)

View file

@ -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');
}
}
?>

View file

@ -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) {

View file

@ -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);

View file

@ -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) {