22 $has_save_confirmation = ($this->
getRecord()->getTable()->getSaveConfirmation() && !isset(
$_GET[
'record_id']));
23 $is_confirmed = (bool) (isset(
$_POST[
'save_confirmed']));
25 if (is_array($media) && $media[
'tmp_name'] !=
"" && (!$has_save_confirmation || $is_confirmed)) {
27 $mob->setTitle($media[
'name']);
30 if (!is_dir($mob_dir)) {
31 $mob->createDirectory();
34 $mob->addMediaItem($media_item);
35 $media_item->setPurpose(
"Standard");
37 $file_name = str_replace(
" ",
"_", $file_name);
38 $file = $mob_dir .
"/" . $file_name;
41 if ($has_save_confirmation) {
43 ilUtil::moveUploadedFile($move_file, $file_name, $file);
45 ilUtil::moveUploadedFile($media[
'tmp_name'], $file_name, $file);
53 list($width, $height,
$type, $attr) = getimagesize($file);
57 if ($new_width || $new_height) {
59 if ($new_height < $height && $new_width < $width) {
61 if (!$new_height || !$new_width) {
76 $media_item->setFormat(
$format);
78 $media_item->setLocationType(
"LocalFile");
81 include_once(
"./Services/MediaObjects/classes/class.ilFFmpeg.php");
83 $med = $mob->getMediaItem(
"Standard");
94 $return = $mob->getId();
97 if (is_array($media) && isset($media[
'tmp_name']) && $media[
'tmp_name'] !=
'') {
118 if (is_numeric($file)) {
120 $mob_name = $mob->getTitle();
155 return $mob->getTitle();
165 if (
$form->getItemByPostVar(
"field_" . $this->getField()->getId())->getDeletionFlag()) {
178 if (!$record_field || !$record_field->getValue()) {
static getCloneOf($id, $type)
Class ilDclBaseFieldModel.
addHiddenItem($a_post_var, $a_value)
Add hidden item.
setValue($value, $omit_parsing=false)
Set value for record field.
addHiddenItemsToConfirmation(ilConfirmationGUI &$confirmation)
parseSortingValue($value, $link=true)
Returns sortable value for the specific field-types.
parseExportValue($value)
Function to parse incoming data from form input value $value.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static extractImage( $a_file, $a_target_filename, $a_target_dir="", $a_sec=1)
Extract image from video file.
if(isset($_POST['submit'])) $form
doUpdate()
Update object in database.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getRecordFieldCache($record, $field)
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
Class ilDclMobRecordFieldModel.
static enabled()
Checks, whether FFmpeg support is enabled (path is set in the setup)
Confirmation screen class.
static supportsImageExtraction($a_mime)
Check if mime type supports image extraction.