mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-08 09:43:01 +02:00
Add a mode to update photos with the upload form. Modify the upload formats form, so that it will update the photo with the same file extension.
This commit is contained in:
@@ -520,8 +520,36 @@ SELECT
|
||||
'filesize' => $file_infos['filesize'],
|
||||
);
|
||||
|
||||
single_insert(IMAGE_FORMAT_TABLE, $insert);
|
||||
$format_id = pwg_db_insert_id(IMAGE_FORMAT_TABLE);
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
format_id
|
||||
FROM '.IMAGE_FORMAT_TABLE.'
|
||||
WHERE image_id = '.$format_of.'
|
||||
AND ext = "'.$format_ext.'"
|
||||
;';
|
||||
|
||||
$formats = query2array($query);
|
||||
if($formats)
|
||||
{
|
||||
$set_fields = array(
|
||||
'filesize' => $file_infos['filesize'],
|
||||
);
|
||||
$where_fields = array(
|
||||
'format_id' => $formats[0]['format_id'],
|
||||
'image_id' => $format_of,
|
||||
'ext' => $format_ext,
|
||||
);
|
||||
single_update(IMAGE_FORMAT_TABLE, $set_fields, $where_fields);
|
||||
$format_id = $formats[0]['format_id'];
|
||||
$add_status = "update";
|
||||
}
|
||||
else
|
||||
{
|
||||
single_insert(IMAGE_FORMAT_TABLE, $insert);
|
||||
$format_id = pwg_db_insert_id(IMAGE_FORMAT_TABLE);
|
||||
$add_status = "add";
|
||||
}
|
||||
|
||||
pwg_activity('photo', $format_of, 'edit', array('action'=>'add format', 'format_ext'=>$format_ext, 'format_id'=>$format_id));
|
||||
|
||||
@@ -530,7 +558,7 @@ SELECT
|
||||
|
||||
trigger_notify('loc_end_add_format', $format_infos);
|
||||
|
||||
return $format_id;
|
||||
return $add_status;
|
||||
}
|
||||
|
||||
add_event_handler('upload_file', 'upload_file_pdf');
|
||||
|
||||
Reference in New Issue
Block a user