forked from Cavemanon/cavepaintings
Added merged indicator to DataUploadEvent and ImageAddEvent
Changed merge process so that the ID of the merged image can make it back through the event chanin
This commit is contained in:
@@ -88,7 +88,7 @@ class ImageIO extends Extension
|
||||
public function onImageAddition(ImageAdditionEvent $event)
|
||||
{
|
||||
try {
|
||||
$this->add_image($event->image);
|
||||
$this->add_image($event);
|
||||
} catch (ImageAdditionException $e) {
|
||||
throw new UploadException($e->error);
|
||||
}
|
||||
@@ -175,10 +175,12 @@ class ImageIO extends Extension
|
||||
|
||||
|
||||
// add image {{{
|
||||
private function add_image(Image $image)
|
||||
private function add_image(ImageAdditionEvent $event)
|
||||
{
|
||||
global $user, $database, $config;
|
||||
|
||||
$image = $event->image;
|
||||
|
||||
/*
|
||||
* Validate things
|
||||
*/
|
||||
@@ -201,7 +203,9 @@ class ImageIO extends Extension
|
||||
if (isset($_GET['source']) && isset($_GET['update'])) {
|
||||
send_event(new SourceSetEvent($existing, $_GET['source']));
|
||||
}
|
||||
return null;
|
||||
$event->merged = true;
|
||||
$event->image = Image::by_id($existing->id);
|
||||
return;
|
||||
} else {
|
||||
$error = "Image <a href='".make_link("post/view/{$existing->id}")."'>{$existing->id}</a> ".
|
||||
"already has hash {$image->hash}:<p>".$this->theme->build_thumb_html($existing);
|
||||
|
Reference in New Issue
Block a user