# specify white background color, will be used for transparent images
# in internet explorer/windows instead of default black.
$cmd = wfescapeshellarg($wgImageMagickConvertCommand) .
- " -background white ".
+ " -background white " .
wfescapeshellarg($srcpath) .
// coalesce is needed to scale animated gifs properly (bug 1017).
' -coalesce ' .
$form->mSessionKey = false;
$form->mStashed = false;
$form->mUploadClicked = true;
- //$form->mReUpload = true;
- // PHP won't auto-cleanup the file
- $form->mRemoveTempFile = file_exists( $local_file);
$form->execute();
}
global $wgContLang;
global $wgUser;
- # add the javascript
- global $wgJsMimeType, $wgScriptPath ;
- $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/EditImage/lib/prototype.js\"></script>\n");
- $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/EditImage/lib/scriptaculous.js\"></script>\n");
- $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/EditImage/cropper.js\"></script>\n");
- $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/EditImage/EditImage.js\"></script>\n");
-
+ # globals for javascript
+ global $wgJsMimeType, $wgScriptPath;
+
# try to find the image that the user entered
$image = $wgRequest->getText('image');
$title = Title::newFromText( $image, NS_IMAGE );
$resized_fn = resizeImage($file->getFullPath(), $x1, $y1, $x2, $y2);
uploadNewFile($file, $resized_fn);
+ # delete the file if it still exists
+ if (file_exists($resized_fn)) { unlink($resized_fn); }
+
} else {
if ( $file && $file->exists() ) {
- $wgOut->addHTML("<p>Use your mouse to select the new area on the image below. When you are done, press crop.</p>\n");
+ # add the javascript
+ $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/EditImage/lib/prototype.js\"></script>\n");
+ $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/EditImage/lib/scriptaculous.js\"></script>\n");
+ $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/EditImage/cropper.js\"></script>\n");
+ $wgOut->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/EditImage/EditImage.js\"></script>\n");
+
+ $instructions = wfMsg('editimage-instructions');
+ $crop_text = wfMsg('cropimage');
+ $wgOut->addHTML("<p>{$instructions}</p>\n");
# add image
$wgOut->addHTML("<div><img src=\"{$file->getUrl()}\" alt=\"source image\" id=\"sourceImage\" /></div>\n");
</td>
</tr><table>
- <p><input type=\"submit\" value=\"Crop Image\" /></p>
+ <p><input type=\"submit\" value=\"{$crop_text}\" /></p>
</form>");
} else {
$wgOut->setStatusCode( 404 );
}
}
-
}
-
}
-
}
?>