Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker版本 #9

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM php:7-apache
USER 0
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh

# make sure apt is up to date
RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
RUN apt-get update --fix-missing
RUN apt-get install -y curl vim nano git
RUN apt-get install -y build-essential libssl-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev

WORKDIR /var/www/html
COPY . /var/www/html
RUN mkdir ./temp
RUN chmod -R 777 ./temp
RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/
RUN docker-php-ext-install gd exif
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
sandphoto
=========
该版本为sandphoto的docker部署
原项目:https://github.com/gmajian/sandphoto
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3'
services:

web:
build: .
ports:
- "8183:80"
48 changes: 47 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="sandphoto.js"></script>
</head>
<body>

<p>
是不是觉得冲印证件照片特别贵? 教你一个省钱的方法: 在一张6寸的照片上排版多张证件照, 然后只要花几角钱就能洗出一堆证件照片了。
怎么? 不会使用Photoshop排版? 懒得去排版? 没关系, 我也是懒得每次用Photoshop排版了, 就自己写了个程序,你来试用一下吧!

</p>

<form id="sandphotoform" action="sandphoto.php" method="POST" enctype="multipart/form-data"><strong>第一步</strong>, 选择你要冲洗的证件照片的尺寸:
<?php
header("location:http://www.sandcomp.com/blog/sandphoto/");
require_once('sandphoto.inc');
$parser = new PhotoTypeParser();
$parser->parse('phototype.txt');
$parser->render_select('target_type', 0, 8);
echo '<br>';
print('<strong>第二步</strong>, 选择用多大的照片冲洗(一般选择6寸的就好,这个价格最合适):');
$parser->render_select('container_type', 8);
?>

<br>
<strong>第三步</strong>, 选择分割线的颜色:

<input id="bgcolorid" type="radio" name="bgcolorid" value="blue" checked="checked" /> 蓝色 <input id="bgcolorid" type="radio" name="bgcolorid" value="white" />白色 <input id="bgcolorid" type="radio" name="bgcolorid" value="gray" /> 灰色


将来的照片就是这个样子的:<br>

<img id="previewImg" alt="" />
<br>
<strong>第四步</strong>, 选择你的证件照片:

<input id="filename" type="file" name="filename" />

<br>
<strong>最后一步</strong>, 点击下载,照片就可以去冲印了:

<input type="submit" value="下载" />

如果你的照片比较大, 上传会花一些时间, 别着急, 请耐心等待。

</form>如果大家有什么建议,请留言。 也欢迎帮助宣传本站。 本站的地址是:<a href="http://www.sandcomp.com/blog/sandphoto/">http://www.sandcomp.com/blog/sandphoto/</a>
</body>
</html>
4 changes: 2 additions & 2 deletions preview.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
require_once("sandphoto.inc");

$filename = "/var/www/sandcomp/apache/htdocs/sandphoto/sample.jpg";
$temp_path = "/var/www/sandcomp/apache/htdocs/sandphoto/temp";
$filename = "./sample.jpg";
$temp_path = "./temp";


$target_type = $_GET["t"];
Expand Down
2 changes: 1 addition & 1 deletion sandphoto.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function updatePreview()
$container_type = $("#container_type option:selected").val();
$bgcolorid= $("#sandphotoform input:radio:checked").val();
if ($target_type && $container_type && $bgcolorid) {
$("#previewImg").attr("src", "/sandphoto/preview.php?t=" + $target_type + "&c=" + $container_type + "&b=" + $bgcolorid);
$("#previewImg").attr("src", "preview.php?t=" + $target_type + "&c=" + $container_type + "&b=" + $bgcolorid);
}
}

Expand Down
49 changes: 0 additions & 49 deletions test.php

This file was deleted.