[svn r20170] FS#3912 - Tests, hot spot questions: Changing validation of question's picture to use file type instead of MIME type.

skala
Ivan Tcholakov 17 years ago
parent 325a79642f
commit 755341891d
  1. 11
      main/exercice/hotspot.class.php

@ -58,7 +58,12 @@ class HotSpot extends Question {
if(!isset($_GET['editQuestion']))
{
$form->addElement('file','imageUpload',get_lang('UploadJpgPicture'));
/*
$form->addRule('imageUpload', get_lang('OnlyJPG'), 'mimetype',array('image/jpeg','image/pjpeg','image/gif','image/png'));
*/
$form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
$form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
}
}
@ -68,8 +73,8 @@ class HotSpot extends Question {
parent::processCreation ($form, $objExercise);
if(!empty($file_info['tmp_name']))
{
$this->uploadPicture($file_info['tmp_name'], $file_info['name']);
list($width,$height) = @getimagesize($file_info['tmp_name']);
$this->uploadPicture($file_info['tmp_name'], $file_info['name']);
list($width,$height) = @getimagesize($file_info['tmp_name']);
if($width>=$height) {
$this->resizePicture('width',544);
} else {
@ -94,4 +99,4 @@ class HotSpot extends Question {
}
endif;
?>
?>

Loading…
Cancel
Save