'default', 0 => 'Ap',1 =>'Kin', 2=>'Mu',3=>'GenEiLateGo', 4=>'Mp2R',5=>'GenGoT', 6=>'GenMinL', 7=>'Ship',8=>'GenGoBl',9=>'GenMinB',10=>'Hannari',11=>'Hare',12=>'GenEiAnti',13=>'irohakakuC-L',14=>'irohamaru-R',15=>'Oradano',16=>'Koburi',17=>'ShipAnti');
//$f= array('no'=>'default', 0 => 'ApTate',1 =>'KinTate', 2=>'MuTate',3=>'GenEiLateGoTate', 4=>'Mp2RTate',5=>'GenGoTTate', 6=>'GenMinLTate', 7=>'ShipTate',8=>'GenGoBlTate',9=>'GenMinBTate',10=>'HannariTate',11=>'HareTate',12=>'GenEiAntiTate',13=>'irohakakuC-LTate',14=>'irohamaru-RTate',15=>'OradanoTate',16=>'KoburiTate',17=>'ShipAntiTate');
//$f2= array('no'=>'default', 0 => 'ApYoko',1 =>'KinYoko', 2=>'MuYoko',3=>'GenEiLateGoYoko', 4=>'Mp2RYoko',5=>'GenGoTYoko', 6=>'GenMinLYoko', 7=>'ShipYoko',8=>'GenGoBlYoko',9=>'GenMinBYoko',10=>'HannariYoko',11=>'HareYoko',12=>'GenEiAntiYoko',13=>'irohakakuC-LYoko',14=>'irohamaru-RYoko',15=>'OradanoYoko',16=>'KoburiYoko',17=>'ShipAntiYoko');
$fonts = array('no'=>'default', 0 => 'Ap',1 =>'Kin', 2=>'Mu',3=>'GenEiLateGo', 4=>'Mp2R',5=>'GenGoT', 6=>'GenMinL', 7=>'Ship',8=>'GenGoBl',9=>'GenMinB',10=>'Hannari',11=>'Hare',12=>'GenEiAnti',13=>'irohakakuC-L',14=>'irohamaru-R',15=>'Oradano',16=>'Koburi',17=>'ShipAnti',18=>'AL',19=>'AB',20=>'Wa',21=>'Zatsu',22=>'ipaexm',23=>'GenMinR',24=>'Satsuki',25=>'GenChikugo',26=>'Mig');
$f= array('no'=>'default', 0 => 'ApTate',1 =>'KinTate', 2=>'MuTate',3=>'GenEiLateGoTate', 4=>'Mp2RTate',5=>'GenGoTTate', 6=>'GenMinLTate', 7=>'ShipTate',8=>'GenGoBlTate',9=>'GenMinBTate',10=>'HannariTate',11=>'HareTate',12=>'GenEiAntiTate',13=>'irohakakuC-LTate',14=>'irohamaru-RTate',15=>'OradanoTate',16=>'KoburiTate',17=>'ShipAntiTate',18=>'ALTate',19=>'ABTate',20=>'WaTate',21=>'ZatsuTate',22=>'ipaexmTate',23=>'GenMinRTate',24=>'SatsukiTate',25=>'GenChikugoTate',26=>'MigTate');
$f2= array('no'=>'default', 0 => 'ApYoko',1 =>'KinYoko', 2=>'MuYoko',3=>'GenEiLateGoYoko', 4=>'Mp2RYoko',5=>'GenGoTYoko', 6=>'GenMinLYoko', 7=>'ShipYoko',8=>'GenGoBlYoko',9=>'GenMinBYoko',10=>'HannariYoko',11=>'HareYoko',12=>'GenEiAntiYoko',13=>'irohakakuC-LYoko',14=>'irohamaru-RYoko',15=>'OradanoYoko',16=>'KoburiYoko',17=>'ShipAntiYoko',18=>'ALYoko',19=>'ABYoko',20=>'WaYoko',21=>'ZatsuYoko',22=>'ipaexmYoko',23=>'GenMinRYoko',24=>'SatsukiYoko',25=>'GenChikugoYoko',26=>'MigYoko');
/* ------------- /初期値 -------------------*/
require_once 'php/menu.php';
// パラメータ初期設定
$param= array();
// ====================================================
// 画像生成
// ====================================================
if ($_POST['imagedata']) {
$imagedata = $_POST["imagedata"];
$filename = $_POST["filename"];
$imagedata = base64_decode($imagedata);
$image = imagecreatefromstring($imagedata);
imagesavealpha($image, TRUE);
imagejpeg($imageJ);
if ($_POST['b'] == 'save') {
header('Content-Type: image/png');
header("Cache-control: no-cache");
header('Content-Disposition: attachment; filename="' . $filename . '.png"');
imagepng($image);
imagedestroy($image);
exit();
} else {
$filename = $filename . '.' . $_POST['b'];
$fp = fopen('mkimg/'. $filename,w);
if ($_POST['b'] == 'jpeg') {
fwrite($fp,base64_decode($_POST["imagedataJ"]));
} else {
fwrite($fp,base64_decode($_POST["imagedata"]));
}
fclose($fp);
// サイズを取得します
list($width, $height) = getimagesize('mkimg/'. $filename);
if ($height > $width) {
$css = <<< CSS
width: 40vh;
height: auto;
max-height:888px;
max-widtht:630px;
CSS;
}else {
$css = <<< CSS
height: 40vh;
width: auto;
max-height:630px;
max-widtht:888px;
}
@media screen and (max-width:66.2vh) {
canvas {
width: 90vw;
height: auto;
}
CSS;
}
// ファイル削除
date_default_timezone_set('Asia/Tokyo');
//削除期限
$expire = strtotime("15 minute ago");
$dir = dirname(__FILE__) . '/mkimg/';
$list = scandir($dir);
foreach($list as $value){
$file = $dir . $value;
if(!is_file($file)) continue;
$mod = filemtime( $file );
if($mod < $expire){
unlink($file);
}
}
// HTML;
echo <<< HTML
8P折り本ツール
{$menu}
8P折り本ツール
{$news}
※生成した画像はご自身の責任においてご自由にお使い下さい。印刷配布も有償・無償を問わずOKです。
※生成できない場合は「フォントデータの軽量化」をお試し下さい。
右クリック→「名前を付けて画像を保存」(PC)または画像長押し(スマートフォン)で保存できます。
{$ad_top}
HTML;
}
// ====================================================
// プレビュー
// ====================================================
} else if ($_POST['t1']) {
require_once 'resize.php';
// テキスト処理
$text1 = $_POST['t1'];
$text1 = preg_replace("/\x{202a}/u", '', $text1 );
$text1 = preg_replace("/\x{202c}/u", '', $text1 );
$text1 = rtrim($text1,"\r\n,\r,\n");
if (! in_array("zen", $_POST['opt'])) {
$text1 = mb_convert_kana($text1, 'AKS');
$text1 = preg_replace('/\'/', "’", $text1 );
$text1 = preg_replace('/"(.*?)"/', "〝$1〟", $text1 );
$text1 = preg_replace('/"/', "”", $text1 );
}
$text1 = preg_replace("/\x{2014}/u", '―', $text1 );
$text1 = preg_replace("/\x{301c}/u", '~', $text1 );
$text1 = preg_replace("/─/", '―', $text1 );
$text1 = preg_replace('/', "<", $text1 );
$text1 = preg_replace('/>/', ">", $text1 );
$writer = $_POST['writer'];
$writer = rtrim($writer,"\r\n,\r,\n");
$writer = preg_replace('/\'/', "’", $writer );
$writer = preg_replace('/"/', "”", $writer );
$writer = preg_replace("/\x{2014}/u", '―', $writer );
$writer = preg_replace("/\x{301c}/u", '~', $writer );
$writer = preg_replace("/─/", '―', $writer );
$writer = preg_replace('/', "<", $writer );
$writer = preg_replace('/>/', ">", $writer );
$writer = htmlspecialchars($writer, ENT_QUOTES, 'UTF-8');
$writer = preg_replace('/\r\n|\r|\n/', "∀", $writer );
if ($_POST['wrimode'] == 'Yoko') {
$text1 = preg_replace('/"(.*?)"/', "“$1”", $text1 );
} else {
$text1 = preg_replace('/“(.*?)”/', "〝$1〟", $text1 );
}
if (in_array("sage", $_POST['opt'])) {
$text1 = ' '. $text1;
$text1 = preg_replace('/\r\n|\r|\n/', "\n ", $text1 );
$text1 = preg_replace('/( )(「|『|(|<|≪|【|\()/', "$2", $text1 );
$text1 = str_replace(' ', ' ', $text1);
}
if (in_array("kan", $_POST['opt'])) {
$text1 = mb_convert_kana($text1, 'N');
$text1 = str_replace('1', '一', $text1);
$text1 = str_replace('2', '二', $text1);
$text1 = str_replace('3', '三', $text1);
$text1 = str_replace('4', '四', $text1);
$text1 = str_replace('5', '五', $text1);
$text1 = str_replace('6', '六', $text1);
$text1 = str_replace('7', '七', $text1);
$text1 = str_replace('8', '八', $text1);
$text1 = str_replace('9', '九', $text1);
$text1 = str_replace('0', '〇', $text1);
}
$text1 = htmlspecialchars($text1, ENT_QUOTES, 'UTF-8');
$text1 = preg_replace('/\r\n|\r|\n/', "∀", $text1 );
$_POST['sig'] = preg_replace('/', "<", $_POST['sig']);
$_POST['sig'] = preg_replace('/>/', ">", $_POST['sig'] );
$_POST['sig'] = preg_replace('/\'/', "’", $_POST['sig'] );
$_POST['sig'] = preg_replace('/"(.*?)"/', "“$1”", $_POST['sig'] );
$_POST['sig'] = htmlspecialchars($_POST['sig'], ENT_QUOTES, 'UTF-8');
$check = file_get_contents('check.txt');
$texts = preg_split("//u", $text1, -1, PREG_SPLIT_NO_EMPTY);
$fuki = preg_split("//u", $_POST['sig'] . $_POST['site'] . $_POST['author'], -1, PREG_SPLIT_NO_EMPTY);
foreach ($texts as $c) {
if (mb_strpos($check, $c)) {
$jo[0]++;
}
}
foreach ($fuki as $c) {
if (mb_strpos($check, $c)) {
$jo[1]++;
}
}
$param['w'] = $_POST['w'];
$param['f'] = $fonts[$_POST['f']].'Tate';
$param['f2'] = $f2[$_POST['f']];
$param['nb'] = $_POST['nb'];
$param['pagination'] = $_POST['pagination'];
$param['startnum'] = $_POST['startnum'];
if ($_POST['joyo']) {
$param['f'] = $param['f'].'J';
$param['f2'] = $param['f2'].'J';
} else {
if (!$jo[0]) {
$param['f'] = $param['f'].'J';
}
if (!$jo[1]) {
$param['f2'] = $param['f2'].'J';
}
}
$param['fontsize2'] = 12;
if ($_POST['c'] == 'picker') {
$param['c'] = $_POST['picker-c'];
} else {
$param['c'] = $_POST['c'];
}
if ($_POST['paper'] == 'picker') {
$param['paper'] = $_POST['picker-p'];
} else {
$param['paper'] = $_POST['paper'];
}
// // 保存画像
$saveid = md5(uniqid(rand(), true));
$savename = 'up_' . md5(uniqid(rand(), true));
if ($_FILES["mybg"]["name"]) {
if ($_POST['agree'] ==1) {
//アップロードされたファイルを取得
$upfile=$_FILES["mybg"]["name"];
//アップされた画像の拡張子を抜き出す
$ext = substr($upfile, strrpos($upfile, '.') + 1);
//拡張子を調べる
if($ext!="jpg" && $ext!="jpeg" && $ext!="gif" && $ext!="png" && $ext!="JPG" && $ext!="JPEG" && $ext!="PNG" && $ext!="GIF"){
$er["image"]="拡張子が「" .$ext ."」のファイルです。jpg、gif、png形式の画像のみアップできます";
}
$file_new_name = md5(uniqid(rand(), true));
$newname = resizeImage($_FILES["mybg"], 910, 'upimg', $file_new_name);
$param['bg'] = 'background-image: url(upimg/' . $newname . ');background-size:auto 100%;';
$imgurl = 'upimg/' . $newname;
} else {
$er["image"] = '画像の権利に関する質問に同意してからアップロードしてください。';
}
}
// 読み込み
$d = $_POST['d'];
require_once 'bunko_orihon_script.php';
require_once 'meishi_fontload.php';
require_once 'font.php';
$param['sizeH2'] = $design[$d]['sizeH'] + 40;
$canvasW = 630 * $design[$d]['coe'] * ($_POST['ql']);
$canvasH = 888 * $design[$d]['coe'] * ($_POST['ql']);
$allW = 630 * 4* $design[$d]['coe'] * ($_POST['ql']);
$allH = 888 * 2 * $design[$d]['coe'] * ($_POST['ql']);
session_start();
// HTML;
echo <<< HTML
8P折り本ツール
{$menu}
8P折り本ツール
{$news}
※生成した画像はご自身の責任においてご自由にお使い下さい。
{$er["image"]}
{$imagesource}
{$ad_top}
PCの場合は、この画像を右クリック→「名前を付けて画像を保存」で保存できます。
スマートフォン等、保存できない場合は下の変換ボタンからどうぞ。
※文字が正しく表示されない→一度戻って再読み込みしてみてください。広告ブロック機能(コンテンツブロッカー)は解除してください。
画像変換ができない→ブラウザを変更してみてください。
HTML;
// ====================================================
// フォーム画面
// ====================================================
} else {
$basename = basename($_SERVER['PHP_SELF']);
require_once 'bunko_orihon_script.php';
// デザイン
$j = 1;
// 幅
while ($j <= $design_num){
$Ji .= ','.$j.':'. $design[$j]['ji'];
$Gyo .= ','.$j.':'. $design[$j]['gyo'];
$j++;
}
// HTML描画
echo <<< HTML
8P折り本ツール
{$menu}
8P折り本ツール
{$news}