mirror of
https://github.com/Chouchen/svgToImage.git
synced 2020-02-03 22:08:42 +01:00
Make this project work again
This commit is contained in:
parent
44004f2ecc
commit
a264742170
71
Log.php
Normal file
71
Log.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
class Log
|
||||
{
|
||||
/** @var false|resource */
|
||||
protected $logfile;
|
||||
|
||||
/**
|
||||
* Log constructor.
|
||||
* @param $filename
|
||||
*/
|
||||
public function __construct($filename)
|
||||
{
|
||||
$file = $filename;
|
||||
$this->logfile = fopen($file, 'ab+');
|
||||
$this->message('Starting log');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $message
|
||||
* @return false|int
|
||||
*/
|
||||
public function message($message)
|
||||
{
|
||||
$message = '[' . date('Y-m-d / H:i:s') . '] @MESSAGE' . ' - ' . $message;
|
||||
$message .= "\n";
|
||||
return fwrite($this->logfile, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $message
|
||||
* @return false|int
|
||||
*/
|
||||
public function error($message)
|
||||
{
|
||||
$message = '[' . date('Y-m-d / H:i:s') . '] @ERROR' . ' - ' . $message;
|
||||
$message .= "\n";
|
||||
return fwrite($this->logfile, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$this->message("Finishing log\n-----------------------");
|
||||
fclose($this->logfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $message
|
||||
* @return string
|
||||
*/
|
||||
public static function decode($message)
|
||||
{
|
||||
if (is_string($message)) {
|
||||
return $message;
|
||||
}
|
||||
|
||||
if (is_array($message)) {
|
||||
return implode('|', $message);
|
||||
}
|
||||
|
||||
if ($message instanceof SimpleXMLElement) {
|
||||
return (string) $message;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
1350
SvgToImage.php
Normal file
1350
SvgToImage.php
Normal file
File diff suppressed because it is too large
Load Diff
29
log.php
29
log.php
@ -1,29 +0,0 @@
|
||||
<?
|
||||
class Log {
|
||||
|
||||
protected $logfile;
|
||||
|
||||
function __construct($filename) {
|
||||
$file = $filename;
|
||||
$this->logfile = fopen($file, 'a+');
|
||||
$this->message('Starting log');
|
||||
}
|
||||
|
||||
function message($message) {
|
||||
$message = '['. date("Y-m-d / H:i:s") . '] @MESSAGE'.' - '.$message;
|
||||
$message .= "\n";
|
||||
return fwrite( $this->logfile, $message );
|
||||
}
|
||||
|
||||
function error($message) {
|
||||
$message = '['. date("Y-m-d / H:i:s") . '] @ERROR'.' - '.$message;
|
||||
$message .= "\n";
|
||||
return fwrite( $this->logfile, $message );
|
||||
}
|
||||
|
||||
function __destruct(){
|
||||
$this->message("Finishing log\n-----------------------");
|
||||
return fclose( $this->logfile );
|
||||
}
|
||||
}
|
||||
|
1184
svgtoimage.php
1184
svgtoimage.php
File diff suppressed because it is too large
Load Diff
8
test.php
8
test.php
@ -1,5 +1,5 @@
|
||||
<?
|
||||
include 'svgtoimage.php';
|
||||
<?php
|
||||
include 'SvgToImage.php';
|
||||
/*
|
||||
<image x="184" y="286" width="10" height="10" preserveAspectRatio="none" href="imageurl4.png" style="cursor: pointer; opacity: 1; display: none; " opacity="1"></image>
|
||||
<image x="204" y="286" width="10" height="10" preserveAspectRatio="none" href="imageurl5.png" style="cursor: pointer; opacity: 1; display: none; " opacity="1"></image>
|
||||
@ -21,11 +21,11 @@ style="fill:white;stroke:red;stroke-width:2"/>
|
||||
$svg = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="600" height="512">
|
||||
<desc>Created with Raphael</desc>
|
||||
<defs></defs>
|
||||
<image x="0" y="0" width="300" height="512" preserveAspectRatio="none" href="http://labs.shikiryu.com/experimental-cut/images/pieces/fond.jpg"></image>
|
||||
<image x="0" y="0" width="300" height="512" preserveAspectRatio="none" href="https://labs.shikiryu.com/experimental-cut/images/pieces/fond.jpg"></image>
|
||||
<rect x="168" y="275" width="52" height="70" r="0" rx="0" ry="0" fill="none" stroke="#FFF" stroke-width="3" stroke-dasharray="8,3" transform="rotate(21.91207728 194 310)" style="opacity: 1;" opacity="1"></rect>
|
||||
<circle cx="50" cy="50" r="50" fill="turquoise" stroke="#000"></circle>
|
||||
<circle cx="100" cy="50" r="40" stroke="#000" stroke-width="2" fill="none"/>
|
||||
<image x="170" y="277" width="48" height="66" preserveAspectRatio="none" href="http://labs.shikiryu.com/experimental-cut/images/pieces/1.png" style="cursor: move; opacity: 1; " r="90" opacity="1" transform="rotate(21.91207728 194 310)"></image>
|
||||
<image x="170" y="277" width="48" height="66" preserveAspectRatio="none" href="https://labs.shikiryu.com/experimental-cut/images/pieces/1.png" style="cursor: move; opacity: 1; " r="90" opacity="1" transform="rotate(21.91207728 194 310)"></image>
|
||||
<path d="M50 50 V150 H150 L200 50 Z" stroke="red" stroke-width="3" stroke-dasharray="2,2" />
|
||||
<polygon points="60,150 160,60 260,150 210,250 110,250" stroke="red" stroke-width="3"/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user