Skip to content

Commit

Permalink
Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
V13Axel committed Feb 6, 2024
1 parent adfb3d2 commit 9c4fb86
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 12 additions & 3 deletions app/Services/RendererService/ImageRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class ImageRenderer
private int $day_number_size;
private int $day_number_padding;

private int $moon_columns;
private int $moon_size;
private string $moon_image;

private int $calendarNameTextSize;

private $weekdays;
Expand Down Expand Up @@ -125,7 +129,7 @@ public function defaults(): Collection
'shadow_size_difference' => 0,
'shadow_strength' => 5,
'grid_line_width' => 1,
'debug' => 0,
'debugimage' => 0,
'snapshot' => 0,
'theme' => 'discord',
'quality' => 95,
Expand Down Expand Up @@ -216,7 +220,10 @@ private function initializeParametricProperties()
$this->moon_columns = min($this->calendar->moons->count(), 4);
$this->moon_size = $this->determineMoonSize();
if($this->moon_size) {
$this->moon_image = sprintf('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="%s" height="%s">', $this->x, $this->y);
$this->moon_image = sprintf('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="%s" height="%s">', $this->calendar_bounding_x2 - $this->calendar_bounding_x1, $this->calendar_bounding_y2 - $this->calendar_bounding_y1);
logger()->info($this->moon_image);
} else {
logger()->info('No moon size');
}

$calendarMaxNameTextSize = $this->header_height / 3.5;
Expand Down Expand Up @@ -617,7 +624,7 @@ private function drawIntercalaryDividers()
*/
private function colorize($type = null)
{
if(request()->get('debug')) {
if(request()->get('debugimage')) {
$hash = md5('color' . rand(1, 500)); // modify 'color' to get a different palettes

return "#" . substr($hash, 0, 2) . substr($hash, 2, 2) . substr($hash, 4, 2);
Expand Down Expand Up @@ -994,6 +1001,8 @@ private function mergeMoonImage()
$im = new Imagick();
$svg = $this->moon_image . "</svg>";

Storage::put('moon.svg', $svg);

$im->setBackgroundColor(new ImagickPixel('transparent'));
$im->readImageBlob($svg);
$im->setImageFormat('png32');
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ services:
volumes:
- ./:/var/task
- ./cache:/var/task/cache
- ./storage:/tmp/storage
user: "${FC_USER_ID:-1000}:${FC_GROUP_ID:-1000}"

queue-worker:
Expand Down

0 comments on commit 9c4fb86

Please sign in to comment.