Index: trunk/extensions/ProofreadPage/ProofreadPage.php |
— | — | @@ -680,11 +680,11 @@ |
681 | 681 | |
682 | 682 | |
683 | 683 | function pr_preloadText( $textbox1, $mTitle ) { |
684 | | - global $wgDjvutxt; |
| 684 | + global $wgDjvuTxt; |
685 | 685 | |
686 | 686 | $page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
687 | 687 | |
688 | | - if ( $wgDjvutxt && preg_match( "/^$page_namespace:(.*?)\/([0-9]*)$/", $mTitle->getPrefixedText(), $m ) ) { |
| 688 | + if ( $wgDjvuTxt && preg_match( "/^$page_namespace:(.*?)\/([0-9]*)$/", $mTitle->getPrefixedText(), $m ) ) { |
689 | 689 | |
690 | 690 | $imageTitle = Title::makeTitleSafe( NS_IMAGE, $m[1] ); |
691 | 691 | if ( !$imageTitle ) { |
— | — | @@ -693,15 +693,15 @@ |
694 | 694 | |
695 | 695 | $image = wfFindFile( $imageTitle ); |
696 | 696 | if ( $image && $image->exists() && $image->getMimeType() == 'image/vnd.djvu' ) { |
697 | | - $srcPath = $image->getPath(); |
698 | | - $cmd = "( " .wfEscapeShellArg( $wgDjvutxt ); |
699 | | - $cmd .= " --page {$m[2]} ". wfEscapeShellArg( $srcPath )." )"; |
700 | | - wfProfileIn( 'ProofreadPage' ); |
701 | | - wfDebug( __METHOD__.": $cmd\n" ); |
702 | | - $out = wfShellExec( $cmd, $retval ); |
703 | | - wfProfileOut( 'ProofreadPage' ); |
704 | 697 | |
705 | | - if($retval==0) $textbox1 = $out; |
| 698 | + $name = $image->thumbName( array( 'width' => '##WIDTH##', 'page' => $m[2] ) ); |
| 699 | + $name = str_replace( '##WIDTH##px', 'djvutxt', $name ); |
| 700 | + $name = str_replace( '.jpg', '.txt', $name ); |
| 701 | + $url = $image->getThumbUrl( $name ); |
| 702 | + |
| 703 | + if($url[0]=='/') $url = "http://localhost" . $url; |
| 704 | + $text = Http::get($url); |
| 705 | + if($text) $textbox1 = $text; |
706 | 706 | } |
707 | 707 | } |
708 | 708 | return true; |