diff --git a/extras/oekaki/finish.pl b/extras/oekaki/finish.pl
index eb28550..4e695af 100755
--- a/extras/oekaki/finish.pl
+++ b/extras/oekaki/finish.pl
@@ -19,6 +19,7 @@ BEGIN { require "strings_en.pl"; }
BEGIN { require "oekaki_style.pl"; }
BEGIN { require "oekaki_config.pl"; }
BEGIN { require "oekaki_strings_en.pl"; }
+BEGIN { require "oekaki_util.pl"; }
BEGIN { require "wakautils.pl"; }
@@ -89,21 +90,22 @@ elsif($task eq "post")
$ENV{SCRIPT_NAME}=~s/\w+\.pl$/wakaba.pl/;
- if ($animated) {
- my $anim_file;
- open $anim_file,$tmpname_pch or die "Can't read pch file";
+ open TMPFILE,$tmpname or die "Can't read uploaded file";
- my ($pch_newname,$pch_md5,$pch_width,$pch_height,$pch_thumb,$pch_twidth,$pch_theight) =
- process_file($anim_file,"internal_animated.pch",time(),1);
+ my $postfix;
- $animated = $pch_newname;
- unlink $tmpname_pch;
+ if ($animated) {
+ $postfix = sub {
+ my $filename = shift;
+ my $pch_filename = oek_pch_mv($filename, $tmpname_pch);
+ return OEKAKI_INFO_TEMPLATE->(decode_srcinfo($srcinfo,$pch_filename));
+ };
+ } else {
+ $postfix = OEKAKI_INFO_TEMPLATE->(decode_srcinfo($srcinfo, $animated));
}
- open TMPFILE,$tmpname or die "Can't read uploaded file";
-
post_stuff($parent,$name,$email,$subject,$comment,\*TMPFILE,$tmpname,$password,
- 0,$captcha,ADMIN_PASS,0,0,OEKAKI_INFO_TEMPLATE->(decode_srcinfo($srcinfo, $animated)));
+ 0,$captcha,ADMIN_PASS,0,0,$postfix);
unlink $tmpname;
}
diff --git a/extras/oekaki/oekaki_config.pl b/extras/oekaki/oekaki_config.pl
index 0dfb714..77cd7e9 100644
--- a/extras/oekaki/oekaki_config.pl
+++ b/extras/oekaki/oekaki_config.pl
@@ -9,7 +9,11 @@ use constant OEKAKI_MAX_X => 800; # Max X dimension allowed for oekaki drawi
use constant OEKAKI_MAX_Y => 800; # Max Y dimension allowed for oekaki drawings
use constant OEKAKI_MIN_X => 100; # Min X dimension allowed for oekaki drawings
use constant OEKAKI_MIN_Y => 100; # Min Y dimension allowed for oekaki drawings
-use constant OEKAKI_ANIM_MAX => 0; # Max file size (in KiB) for animation recording
+
+use constant OEKAKI_ANIM_MAX => 0; # Max file size (in KiB) for animation recording
+use constant OEKAKI_ANIM_DIR => 'ani/'; # Directory to store .pch animation files
+ # this can be the same as IMG_DIR, but that
+ # is mildly not recommended. Must be writeable
use constant OEKAKI_DEFAULT_PAINTER => "shi_norm"; # Default painter selection
diff --git a/extras/oekaki/oekaki_style.pl b/extras/oekaki/oekaki_style.pl
index 432264b..172c351 100644
--- a/extras/oekaki/oekaki_style.pl
+++ b/extras/oekaki/oekaki_style.pl
@@ -4,6 +4,7 @@ use strict;
BEGIN { require 'oekaki_config.pl'; }
BEGIN { require 'oekaki_strings_en.pl'; }
+BEGIN { require 'oekaki_util.pl'; }
BEGIN { require 'futaba_style.pl'; }
BEGIN { require 'wakautils.pl'; }
diff --git a/extras/oekaki/oekaki_util.pl b/extras/oekaki/oekaki_util.pl
new file mode 100644
index 0000000..ac1186a
--- /dev/null
+++ b/extras/oekaki/oekaki_util.pl
@@ -0,0 +1,47 @@
+BEGIN { require "config.pl"; }
+BEGIN { require "config_defaults.pl"; }
+
+sub oek_pch_filename($) {
+ my ($filename) = @_;
+ my $pch_filename = $filename;
+ # trim dir
+ $pch_filename =~ s:^.*/([^/]+)$:$1:;
+ # trim extension
+ $pch_filename =~ s/[.][^.]+$//;
+ # put in the anim dir, and give a .pch extension
+ $pch_filename = OEKAKI_ANIM_DIR.$pch_filename.".pch";
+
+ return $pch_filename;
+}
+
+sub oek_pch_mv($$) {
+ my ($img_filename, $tmpname) = @_;
+ my $pch_filename;
+ my $buffer;
+
+ open PCHTMP,$tmpname or die "Can't read temporary PCH file";
+ binmode PCHTMP;
+
+ $pch_filename = oek_pch_filename($img_filename);
+ if (-e $pch_filename) {
+ unlink $img_filename;
+ make_error(S_DUPENAME);
+ }
+
+ if (not open (OUTFILE,">>$pch_filename")) {
+ unlink $img_filename;
+ make_error(S_NOTWRITE);
+ }
+ binmode OUTFILE;
+ while (read(PCHTMP,$buffer,4096)) {
+ print OUTFILE $buffer;
+ }
+ close PCHTMP;
+ close OUTFILE;
+
+ unlink $tmpname;
+
+ return $pch_filename;
+}
+
+1;
diff --git a/extras/oekaki/pchview.html b/extras/oekaki/pchview.html
index adc139b..5970c50 100755
--- a/extras/oekaki/pchview.html
+++ b/extras/oekaki/pchview.html
@@ -8,64 +8,66 @@ table.nospace { border-collapse:collapse; }
table.nospace tr td { margin:0px; }
.menu { background-color:#CFCFFF; border: 1px solid #666666; padding: 2px; margin-bottom: 2px; }
+
+
+
-
+if (amp < 0) {
+ amp = hash;
+}
+var end = amp;
+if (hash < amp) {
+ end = hash;
+}
+var filename;
+if (end < 0) {
+ filename = href.slice(start);
+} else {
+ filename = href.slice(start, end);
+}
+if (filename.length < 1) {
+ err("No PCH file specified?");
+ return;
+}
+document.title = "PCHViewer: Playing " + filename;
-
+document.write('\n' +
+ '\n' +
+ ' |
\n');
+}
+onLoad();
-
+//-->
+
-