$f_image_description = Input::Get('f_image_description');
$f_image_photographer = Input::Get('f_image_photographer');
$f_image_place = Input::Get('f_image_place');
$f_image_date = Input::Get('f_image_date');
$f_image_url = Input::Get('f_image_url', 'string', '', true);
$BackLink = Input::Get('BackLink', 'string', null, true);
if (!Input::IsValid()) {
camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), null, true);
exit;
}
$articleObj = new Article($f_language_selected, $f_article_number);
// If the template ID is in use, dont add the image.
if (ArticleImage::TemplateIdInUse($f_article_number, $f_image_template_id)) {
camp_html_add_msg(getGS("The image number specified is already in use."));
camp_html_goto_page(camp_html_article_url($articleObj, $f_language_id, 'images/popup.php'));
}
$attributes = array();
$attributes['Description'] = $f_image_description;
$attributes['Photographer'] = $f_image_photographer;
$attributes['Place'] = $f_image_place;
$attributes['Date'] = $f_image_date;
if (!empty($f_image_url)) {
if (camp_is_valid_url($f_image_url)) {
$image = Image::OnAddRemoteImage($f_image_url, $attributes, $g_user->getUserId());
} else {
camp_html_add_msg(getGS("The URL you entered is invalid: '$1'", htmlspecialchars($f_image_url)));
camp_html_goto_page(camp_html_article_url($articleObj, $f_language_id, 'images/popup.php'));