getSchema(), "http://koolielu.ee/schemas/Media")) { if (get_uploaded_file('resource_image') && substr_count($_FILES['resource_image']['type'],'image/')) { $supported_formats = getSupportedImageFormats(); if (in_array(exif_imagetype($_FILES['resource_image']['tmp_name']), $supported_formats)) { // delete previous file $prev_resource = get_data_row("SELECT * FROM {$CONFIG->dbprefix}koolielu_frontpage_resource WHERE subtype='waramu_resource' and subject='$subject'"); if ($prev_resource->ID) deleteImageFile($prev_resource->ID . ".jpg", $prev_resource->user_guid); $resized_image = get_resized_image_from_uploaded_file('resource_image', 150, 150, false); $resized = saveImageFile($rid . '.jpg', $resized_image, $_SESSION['user']->getGUID()); $success = true; } } } else { $success = true; } if ($success) { newFrontPageResource($rid, 'waramu_resource', $_SESSION['user']->getGUID(), $desc, $subject); forward($CONFIG->wwwroot.'pg/info'); return; } /*translation:Choose image for material*/ register_error(elgg_echo('koolielu:image_missing')); forward($CONFIG->wwwroot.'pg/waramu/frontpage/'.$rid); ?>