File: C:/xampp/htdocs/ACFrame/TVI-parsing11.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Frame calculation</title>
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #ffffff;
margin: 0; /* 比較好的做法是將 Body 元素的邊界與欄位間隔調整為零,以處理不同的瀏覽器預設值 */
padding: 0;
text-align: center; /* 這樣會讓容器在 IE 5* 瀏覽器內置中對齊。然後,文字會在 #container 選取器中設定為靠左對齊預設值 */
color: #000000;
}
.oneColElsCtr #container {
width: 46em;
background: #FFFFFF;
margin: 0 auto; /* 自動邊界 (搭配寬度) 會讓頁面置中對齊 */
border: 0px solid #000000;
text-align: left; /* 這樣做會覆寫 Body 元素上的 text-align: center。 */
}
.oneColElsCtr #mainContent {
padding: 0 20px; /* 請記住,欄位間隔就是 Div 方塊內部的空間,而邊界就是 Div 方塊外部的空間 */
}
-->
</style></head>
<body class="oneColElsCtr">
<br>
<br>
<?php
$dtime=time();
$dStr=substr($dtime,7,9)."-";
$sum=100;
$check=1;
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Frame Calculate" . "<br />";
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
$filename=$dStr.$_FILES["file"]["name"];
//echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
// echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists("upload/" . $_FILES["file"]["name"]))
{
?><font color="red"><?php
echo "Sorry! ";
echo $_FILES["file"]["name"] . " 檔案重覆. ". "<br />";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" .$dStr. $_FILES["file"]["name"]);
echo "upload sucess! " . "<br />";
$contents = file("upload/".$dStr.$_FILES["file"]["name"]);
$string = implode($contents);
//echo $contents[20];
//echo $string;
$p = ereg_replace("\r\n?", "\n", $string);
$p = str_replace("\n", ',', $p);
//echo $p;
$dot = explode(",", $p);
$result = count($dot);
echo "result=".$result;
for ( $i = 4; $i <= $result-4; $i += 4) {
echo $i."xx".$dot[$i]."_dot_";
$j=0;
// Create a blank image and add some text
if ($margin=='off'){
for ( $j= 1; $j<= $dot[$i+2]; $j +=1){
$im = imagecreatetruecolor($dot[$i]*28.346, $dot[$i+1]*28.346);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
// Save the image as 'simpletext.jpg'
imagejpeg($im, (($i)/4).'-frame-'.$j.'.jpg');
// Free up memory
imagedestroy($im);}
}
else
{
for ( $j= 1; $j<= $dot[$i+2]; $j +=1){
$im = imagecreatetruecolor(($dot[$i]*28.346)+(($dot[$i+3]*2)*28.346), ($dot[$i+1]*28.346)+(($dot[$i+3]*2)*28.346));
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
// Save the image as 'simpletext.jpg'
imagejpeg($im, (($i)/4).'-frame-'.$j.'.jpg');
// Free up memory
imagedestroy($im);}
}
}
?>
</table>
<?php
}
}
?>
<tr>
<td align="center"><font size="-2"> © <a href="mailto:[email protected]">Fred Kuo</a>, 2010. All rights reserved.<br><a href="http://www.fredkuo.idv.tw/wordpress/?p=1025">Read more.</a><br>
</td>
</tr>
</body>
</html>