This commit is contained in:
parent
ab0ac45415
commit
9196bf07a7
5 changed files with 8 additions and 10 deletions
|
|
@ -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.
|
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
|
## 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:
|
ApFab Zap Machine needs some PHP extensions:
|
||||||
- JSON (default installed)
|
- JSON (default installed)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ if (!defined('BRAVE_API_KEY')) {
|
||||||
/**
|
/**
|
||||||
* Define some app-wide constants
|
* 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_WEB_DIR', 'www');
|
||||||
define('ZAP_RESOURCE_DIR', 'resource');
|
define('ZAP_RESOURCE_DIR', 'resource');
|
||||||
define('ZAP_UTILS_DIR', 'utils');
|
define('ZAP_UTILS_DIR', 'utils');
|
||||||
|
|
@ -104,7 +104,7 @@ function getZAPTemplate($tplname) {
|
||||||
if (file_exists($tplfilepath)) {
|
if (file_exists($tplfilepath)) {
|
||||||
return $tplfilepath;
|
return $tplfilepath;
|
||||||
} else {
|
} else {
|
||||||
return ERROR_PREFIX . 'No template';
|
throw new Exception(ERROR_PREFIX . 'No template');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
@ -212,7 +212,7 @@ Key differences from the web entry point:
|
||||||
|
|
||||||
### Logging
|
### 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
|
```php
|
||||||
if (ZAP_LOG == true) {
|
if (ZAP_LOG == true) {
|
||||||
|
|
|
||||||
|
|
@ -112,10 +112,8 @@ class ImgTools {
|
||||||
$mimeType = $imgInfo['mime'];
|
$mimeType = $imgInfo['mime'];
|
||||||
//find gif
|
//find gif
|
||||||
if ($mimeType == "image/gif") {
|
if ($mimeType == "image/gif") {
|
||||||
$imagetype = 'png';
|
// Replace .gif extension with .png
|
||||||
//full image name
|
$newFilename = preg_replace('/\.gif$/i', '.png', $filename);
|
||||||
$Dot = '.';
|
|
||||||
$newFilename = "$filename$Dot$imagetype";
|
|
||||||
//convert
|
//convert
|
||||||
$img = new Imagick($filename);
|
$img = new Imagick($filename);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ class Log {
|
||||||
$this->folder = $imgFolder;
|
$this->folder = $imgFolder;
|
||||||
|
|
||||||
$this->logFileName = $imgFolder . DIRECTORY_SEPARATOR . 'log.txt';
|
$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) {
|
public function addToLog($type, $head, $addString) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue