2021-12-14 18:32:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2019-06-18 18:45:59 +00:00
|
|
|
|
2023-01-10 22:44:09 +00:00
|
|
|
namespace Shimmie2;
|
|
|
|
|
2019-08-07 19:53:59 +00:00
|
|
|
require_once "config.php";
|
2019-06-18 18:45:59 +00:00
|
|
|
|
2011-09-03 23:34:46 +00:00
|
|
|
/**
|
|
|
|
* A class to handle adding / getting / removing image files from the disk.
|
2007-04-16 11:58:25 +00:00
|
|
|
*/
|
2019-05-28 16:59:38 +00:00
|
|
|
class ImageIO extends Extension
|
|
|
|
{
|
2020-02-04 00:46:36 +00:00
|
|
|
/** @var ImageIOTheme */
|
2023-06-27 14:56:49 +00:00
|
|
|
protected Themelet $theme;
|
2020-02-04 00:46:36 +00:00
|
|
|
|
2021-12-14 18:32:47 +00:00
|
|
|
public const COLLISION_OPTIONS = [
|
2023-11-11 21:49:12 +00:00
|
|
|
'Error' => ImageConfig::COLLISION_ERROR,
|
|
|
|
'Merge' => ImageConfig::COLLISION_MERGE
|
2020-06-14 16:05:55 +00:00
|
|
|
];
|
2019-06-18 18:45:59 +00:00
|
|
|
|
2021-12-14 18:32:47 +00:00
|
|
|
public const ON_DELETE_OPTIONS = [
|
2023-11-11 21:49:12 +00:00
|
|
|
'Return to post list' => ImageConfig::ON_DELETE_LIST,
|
|
|
|
'Go to next post' => ImageConfig::ON_DELETE_NEXT
|
2020-10-08 22:07:33 +00:00
|
|
|
];
|
|
|
|
|
2021-12-14 18:32:47 +00:00
|
|
|
public const EXIF_READ_FUNCTION = "exif_read_data";
|
2019-06-18 18:45:59 +00:00
|
|
|
|
2021-12-14 18:32:47 +00:00
|
|
|
public const THUMBNAIL_ENGINES = [
|
2019-06-24 15:05:16 +00:00
|
|
|
'Built-in GD' => MediaEngine::GD,
|
|
|
|
'ImageMagick' => MediaEngine::IMAGICK
|
2019-06-18 18:45:59 +00:00
|
|
|
];
|
|
|
|
|
2021-12-14 18:32:47 +00:00
|
|
|
public const THUMBNAIL_TYPES = [
|
2020-06-14 16:05:55 +00:00
|
|
|
'JPEG' => MimeType::JPEG,
|
2023-03-22 23:33:16 +00:00
|
|
|
'WEBP (Not IE compatible)' => MimeType::WEBP
|
2019-06-18 18:45:59 +00:00
|
|
|
];
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
public function onInitExt(InitExtEvent $event)
|
|
|
|
{
|
|
|
|
global $config;
|
2020-06-24 13:15:58 +00:00
|
|
|
$config->set_default_string(ImageConfig::THUMB_ENGINE, MediaEngine::GD);
|
2019-06-18 18:45:59 +00:00
|
|
|
$config->set_default_int(ImageConfig::THUMB_WIDTH, 192);
|
|
|
|
$config->set_default_int(ImageConfig::THUMB_HEIGHT, 192);
|
|
|
|
$config->set_default_int(ImageConfig::THUMB_SCALING, 100);
|
|
|
|
$config->set_default_int(ImageConfig::THUMB_QUALITY, 75);
|
2020-06-14 16:05:55 +00:00
|
|
|
$config->set_default_string(ImageConfig::THUMB_MIME, MimeType::JPEG);
|
2020-06-11 21:58:19 +00:00
|
|
|
$config->set_default_string(ImageConfig::THUMB_FIT, Media::RESIZE_TYPE_FIT);
|
2020-06-14 16:36:52 +00:00
|
|
|
$config->set_default_string(ImageConfig::THUMB_ALPHA_COLOR, Media::DEFAULT_ALPHA_CONVERSION_COLOR);
|
2019-06-18 18:45:59 +00:00
|
|
|
|
|
|
|
if (function_exists(self::EXIF_READ_FUNCTION)) {
|
|
|
|
$config->set_default_bool(ImageConfig::SHOW_META, false);
|
2019-05-28 16:59:38 +00:00
|
|
|
}
|
2019-06-18 18:45:59 +00:00
|
|
|
$config->set_default_string(ImageConfig::ILINK, '');
|
|
|
|
$config->set_default_string(ImageConfig::TLINK, '');
|
|
|
|
$config->set_default_string(ImageConfig::TIP, '$tags // $size // $filesize');
|
|
|
|
$config->set_default_string(ImageConfig::UPLOAD_COLLISION_HANDLER, ImageConfig::COLLISION_ERROR);
|
2023-11-11 21:49:12 +00:00
|
|
|
$config->set_default_int(ImageConfig::EXPIRES, (60 * 60 * 24 * 31)); // defaults to one month
|
2019-05-28 16:59:38 +00:00
|
|
|
}
|
|
|
|
|
2020-06-14 16:05:55 +00:00
|
|
|
public function onDatabaseUpgrade(DatabaseUpgradeEvent $event)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
if ($this->get_version(ImageConfig::VERSION) < 1) {
|
|
|
|
switch ($config->get_string("thumb_type")) {
|
|
|
|
case FileExtension::WEBP:
|
|
|
|
$config->set_string(ImageConfig::THUMB_MIME, MimeType::WEBP);
|
|
|
|
break;
|
|
|
|
case FileExtension::JPEG:
|
|
|
|
$config->set_string(ImageConfig::THUMB_MIME, MimeType::JPEG);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$config->set_string("thumb_type", null);
|
|
|
|
|
|
|
|
$this->set_version(ImageConfig::VERSION, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
public function onPageRequest(PageRequestEvent $event)
|
|
|
|
{
|
2024-01-03 15:08:41 +00:00
|
|
|
global $config, $page;
|
|
|
|
|
|
|
|
$thumb_width = $config->get_int(ImageConfig::THUMB_WIDTH, 192);
|
|
|
|
$thumb_height = $config->get_int(ImageConfig::THUMB_HEIGHT, 192);
|
|
|
|
$page->add_html_header("<style>:root {--thumb-width: {$thumb_width}px; --thumb-height: {$thumb_height}px;}</style>");
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
if ($event->page_matches("image/delete")) {
|
|
|
|
global $page, $user;
|
2019-07-09 14:10:21 +00:00
|
|
|
if ($user->can(Permissions::DELETE_IMAGE) && isset($_POST['image_id']) && $user->check_auth_token()) {
|
2020-01-26 19:44:36 +00:00
|
|
|
$image = Image::by_id(int_escape($_POST['image_id']));
|
2019-05-28 16:59:38 +00:00
|
|
|
if ($image) {
|
|
|
|
send_event(new ImageDeletionEvent($image));
|
2020-10-08 22:07:33 +00:00
|
|
|
|
2023-11-11 21:49:12 +00:00
|
|
|
if ($config->get_string(ImageConfig::ON_DELETE) === ImageConfig::ON_DELETE_NEXT) {
|
2020-10-08 22:07:33 +00:00
|
|
|
redirect_to_next_image($image);
|
|
|
|
} else {
|
|
|
|
$page->set_mode(PageMode::REDIRECT);
|
2023-08-18 11:42:42 +00:00
|
|
|
$page->set_redirect(referer_or(make_link(), ['post/view']));
|
2020-10-08 22:07:33 +00:00
|
|
|
}
|
2019-05-28 16:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} elseif ($event->page_matches("image")) {
|
|
|
|
$num = int_escape($event->get_arg(0));
|
|
|
|
$this->send_file($num, "image");
|
|
|
|
} elseif ($event->page_matches("thumb")) {
|
|
|
|
$num = int_escape($event->get_arg(0));
|
|
|
|
$this->send_file($num, "thumb");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event)
|
|
|
|
{
|
|
|
|
global $user;
|
2019-10-02 10:23:57 +00:00
|
|
|
|
2019-07-09 14:10:21 +00:00
|
|
|
if ($user->can(Permissions::DELETE_IMAGE)) {
|
2019-05-28 16:59:38 +00:00
|
|
|
$event->add_part($this->theme->get_deleter_html($event->image->id));
|
|
|
|
}
|
|
|
|
/* In the future, could perhaps allow users to replace images that they own as well... */
|
2019-07-09 14:10:21 +00:00
|
|
|
if ($user->can(Permissions::REPLACE_IMAGE)) {
|
2019-05-28 16:59:38 +00:00
|
|
|
$event->add_part($this->theme->get_replace_html($event->image->id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function onImageAddition(ImageAdditionEvent $event)
|
|
|
|
{
|
2020-01-29 20:22:50 +00:00
|
|
|
global $config;
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
try {
|
2020-01-29 20:22:50 +00:00
|
|
|
$image = $event->image;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check for an existing image
|
|
|
|
*/
|
|
|
|
$existing = Image::by_hash($image->hash);
|
|
|
|
if (!is_null($existing)) {
|
|
|
|
$handler = $config->get_string(ImageConfig::UPLOAD_COLLISION_HANDLER);
|
|
|
|
if ($handler == ImageConfig::COLLISION_MERGE || isset($_GET['update'])) {
|
|
|
|
$event->merged = true;
|
2024-01-05 13:53:21 +00:00
|
|
|
$event->image = $existing;
|
2020-01-29 20:22:50 +00:00
|
|
|
return;
|
|
|
|
} else {
|
2024-01-01 04:10:38 +00:00
|
|
|
throw new ImageAdditionException(">>{$existing->id} already has hash {$image->hash}");
|
2020-01-29 20:22:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// actually insert the info
|
|
|
|
$image->save_to_db();
|
|
|
|
|
2024-01-09 01:03:46 +00:00
|
|
|
send_event(new ThumbnailGenerationEvent($image));
|
|
|
|
|
2020-10-09 12:47:42 +00:00
|
|
|
log_info("image", "Uploaded >>{$image->id} ({$image->hash})");
|
2019-05-28 16:59:38 +00:00
|
|
|
} catch (ImageAdditionException $e) {
|
|
|
|
throw new UploadException($e->error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function onImageDeletion(ImageDeletionEvent $event)
|
|
|
|
{
|
|
|
|
$event->image->delete();
|
|
|
|
}
|
|
|
|
|
2023-03-30 19:38:23 +00:00
|
|
|
public function onCommand(CommandEvent $event)
|
|
|
|
{
|
|
|
|
if ($event->cmd == "help") {
|
|
|
|
print "\tdelete <post id>\n";
|
|
|
|
print "\t\tdelete a specific post\n\n";
|
|
|
|
}
|
|
|
|
if ($event->cmd == "delete") {
|
|
|
|
$post_id = (int)$event->args[0];
|
|
|
|
$image = Image::by_id($post_id);
|
|
|
|
send_event(new ImageDeletionEvent($image));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
public function onImageReplace(ImageReplaceEvent $event)
|
|
|
|
{
|
2024-01-05 13:53:21 +00:00
|
|
|
$original = $event->original;
|
|
|
|
$replacement = $event->replacement;
|
2020-01-29 20:22:50 +00:00
|
|
|
|
2024-01-05 13:53:21 +00:00
|
|
|
try {
|
|
|
|
$duplicate = Image::by_hash($replacement->hash);
|
|
|
|
if (!is_null($duplicate) && $duplicate->id != $original->id) {
|
|
|
|
throw new ImageReplaceException(">>{$duplicate->id} already has hash {$replacement->hash}");
|
2020-01-29 20:22:50 +00:00
|
|
|
}
|
|
|
|
|
2024-01-05 13:53:21 +00:00
|
|
|
$replacement->set_mime(
|
|
|
|
MimeType::get_for_file($replacement->get_image_filename())
|
|
|
|
);
|
2020-01-29 20:22:50 +00:00
|
|
|
|
|
|
|
// Update the data in the database.
|
2024-01-05 13:53:21 +00:00
|
|
|
if (empty($replacement->source)) {
|
|
|
|
$replacement->source = $original->get_source();
|
|
|
|
}
|
|
|
|
$replacement->posted = $original->posted;
|
|
|
|
$replacement->id = $original->id;
|
|
|
|
send_event(new MediaCheckPropertiesEvent($replacement));
|
|
|
|
$replacement->save_to_db();
|
2020-01-29 20:22:50 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
This step could be optional, ie: perhaps move the image somewhere
|
|
|
|
and have it stored in a 'replaced images' list that could be
|
|
|
|
inspected later by an admin?
|
|
|
|
*/
|
|
|
|
|
2024-01-05 13:53:21 +00:00
|
|
|
log_debug("image", "Removing image with hash " . $original->hash);
|
|
|
|
$original->remove_image_only(); // Actually delete the old image file from disk
|
2020-01-29 20:22:50 +00:00
|
|
|
|
|
|
|
/* Generate new thumbnail */
|
2024-01-09 01:03:46 +00:00
|
|
|
send_event(new ThumbnailGenerationEvent($replacement));
|
2020-01-29 20:22:50 +00:00
|
|
|
|
2024-01-05 13:53:21 +00:00
|
|
|
log_info("image", "Replaced >>{$original->id} with ({$replacement->hash})");
|
2019-05-28 16:59:38 +00:00
|
|
|
} catch (ImageReplaceException $e) {
|
|
|
|
throw new UploadException($e->error);
|
|
|
|
}
|
|
|
|
}
|
2019-10-02 10:23:57 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
public function onUserPageBuilding(UserPageBuildingEvent $event)
|
|
|
|
{
|
2019-12-15 15:40:15 +00:00
|
|
|
$u_name = url_escape($event->display_user->name);
|
2023-12-14 16:33:21 +00:00
|
|
|
$i_image_count = Search::count_images(["user={$event->display_user->name}"]);
|
2019-05-28 16:59:38 +00:00
|
|
|
$i_days_old = ((time() - strtotime($event->display_user->join_date)) / 86400) + 1;
|
|
|
|
$h_image_rate = sprintf("%.1f", ($i_image_count / $i_days_old));
|
2023-08-18 12:38:55 +00:00
|
|
|
$images_link = search_link(["user=$u_name"]);
|
2020-10-26 15:15:20 +00:00
|
|
|
$event->add_stats("<a href='$images_link'>Posts uploaded</a>: $i_image_count, $h_image_rate per day");
|
2019-05-28 16:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function onSetupBuilding(SetupBuildingEvent $event)
|
|
|
|
{
|
2020-06-11 21:58:19 +00:00
|
|
|
global $config;
|
|
|
|
|
2020-10-26 15:13:28 +00:00
|
|
|
$sb = $event->panel->create_new_block("Post Options");
|
2020-06-11 21:58:19 +00:00
|
|
|
$sb->start_table();
|
2019-05-28 16:59:38 +00:00
|
|
|
$sb->position = 30;
|
|
|
|
// advanced only
|
2019-06-18 18:45:59 +00:00
|
|
|
//$sb->add_text_option(ImageConfig::ILINK, "Image link: ");
|
|
|
|
//$sb->add_text_option(ImageConfig::TLINK, "<br>Thumbnail link: ");
|
2020-10-26 15:15:20 +00:00
|
|
|
$sb->add_text_option(ImageConfig::TIP, "Post tooltip", true);
|
|
|
|
$sb->add_text_option(ImageConfig::INFO, "Post info", true);
|
2020-06-11 21:58:19 +00:00
|
|
|
$sb->add_choice_option(ImageConfig::UPLOAD_COLLISION_HANDLER, self::COLLISION_OPTIONS, "Upload collision handler", true);
|
2020-10-08 22:07:33 +00:00
|
|
|
$sb->add_choice_option(ImageConfig::ON_DELETE, self::ON_DELETE_OPTIONS, "On Delete", true);
|
2019-06-18 18:45:59 +00:00
|
|
|
if (function_exists(self::EXIF_READ_FUNCTION)) {
|
2020-06-11 21:58:19 +00:00
|
|
|
$sb->add_bool_option(ImageConfig::SHOW_META, "Show metadata", true);
|
2019-05-28 16:59:38 +00:00
|
|
|
}
|
2020-06-11 21:58:19 +00:00
|
|
|
$sb->end_table();
|
2019-05-28 16:59:38 +00:00
|
|
|
|
2020-10-26 15:13:28 +00:00
|
|
|
$sb = $event->panel->create_new_block("Thumbnailing");
|
2020-06-11 21:58:19 +00:00
|
|
|
$sb->start_table();
|
|
|
|
$sb->add_choice_option(ImageConfig::THUMB_ENGINE, self::THUMBNAIL_ENGINES, "Engine", true);
|
2020-06-14 16:05:55 +00:00
|
|
|
$sb->add_choice_option(ImageConfig::THUMB_MIME, self::THUMBNAIL_TYPES, "Filetype", true);
|
2020-06-11 21:58:19 +00:00
|
|
|
|
|
|
|
$sb->add_int_option(ImageConfig::THUMB_WIDTH, "Max Width", true);
|
|
|
|
$sb->add_int_option(ImageConfig::THUMB_HEIGHT, "Max Height", true);
|
|
|
|
|
|
|
|
$options = [];
|
|
|
|
foreach (MediaEngine::RESIZE_TYPE_SUPPORT[$config->get_string(ImageConfig::THUMB_ENGINE)] as $type) {
|
|
|
|
$options[$type] = $type;
|
|
|
|
}
|
|
|
|
|
|
|
|
$sb->add_choice_option(ImageConfig::THUMB_FIT, $options, "Fit", true);
|
|
|
|
|
|
|
|
$sb->add_int_option(ImageConfig::THUMB_QUALITY, "Quality", true);
|
|
|
|
$sb->add_int_option(ImageConfig::THUMB_SCALING, "High-DPI Scale %", true);
|
2023-11-11 21:49:12 +00:00
|
|
|
if ($config->get_string(ImageConfig::THUMB_MIME) === MimeType::JPEG) {
|
2020-06-14 16:36:52 +00:00
|
|
|
$sb->add_color_option(ImageConfig::THUMB_ALPHA_COLOR, "Alpha Conversion Color", true);
|
|
|
|
}
|
2020-06-11 21:58:19 +00:00
|
|
|
|
|
|
|
$sb->end_table();
|
2019-05-28 16:59:38 +00:00
|
|
|
}
|
|
|
|
|
2020-02-09 19:22:25 +00:00
|
|
|
public function onParseLinkTemplate(ParseLinkTemplateEvent $event)
|
|
|
|
{
|
|
|
|
$fname = $event->image->get_filename();
|
2020-10-25 19:31:58 +00:00
|
|
|
$base_fname = str_contains($fname, '.') ? substr($fname, 0, strrpos($fname, '.')) : $fname;
|
2020-02-09 19:22:25 +00:00
|
|
|
|
|
|
|
$event->replace('$id', (string)$event->image->id);
|
|
|
|
$event->replace('$hash_ab', substr($event->image->hash, 0, 2));
|
|
|
|
$event->replace('$hash_cd', substr($event->image->hash, 2, 2));
|
|
|
|
$event->replace('$hash', $event->image->hash);
|
|
|
|
$event->replace('$filesize', to_shorthand_int($event->image->filesize));
|
|
|
|
$event->replace('$filename', $base_fname);
|
2020-07-07 16:02:29 +00:00
|
|
|
$event->replace('$ext', $event->image->get_ext());
|
2020-02-09 19:22:25 +00:00
|
|
|
$event->replace('$date', autodate($event->image->posted, false));
|
2020-10-25 13:30:00 +00:00
|
|
|
$event->replace("\\n", "\n");
|
2020-02-09 19:22:25 +00:00
|
|
|
}
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
private function send_file(int $image_id, string $type)
|
|
|
|
{
|
2020-06-16 23:40:13 +00:00
|
|
|
global $config, $page;
|
2019-05-28 16:59:38 +00:00
|
|
|
|
2020-06-16 23:40:13 +00:00
|
|
|
$image = Image::by_id($image_id);
|
2019-05-28 16:59:38 +00:00
|
|
|
if (!is_null($image)) {
|
|
|
|
if ($type == "thumb") {
|
2020-06-14 16:05:55 +00:00
|
|
|
$mime = $config->get_string(ImageConfig::THUMB_MIME);
|
2019-05-28 16:59:38 +00:00
|
|
|
$file = $image->get_thumb_filename();
|
|
|
|
} else {
|
2020-06-14 16:05:55 +00:00
|
|
|
$mime = $image->get_mime();
|
2019-05-28 16:59:38 +00:00
|
|
|
$file = $image->get_image_filename();
|
|
|
|
}
|
2020-06-12 01:09:17 +00:00
|
|
|
if (!file_exists($file)) {
|
|
|
|
http_response_code(404);
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
2020-06-14 16:05:55 +00:00
|
|
|
$page->set_mime($mime);
|
|
|
|
|
2020-06-12 01:09:17 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])) {
|
|
|
|
$if_modified_since = preg_replace('/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"]);
|
|
|
|
} else {
|
|
|
|
$if_modified_since = "";
|
|
|
|
}
|
|
|
|
$gmdate_mod = gmdate('D, d M Y H:i:s', filemtime($file)) . ' GMT';
|
|
|
|
|
|
|
|
if ($if_modified_since == $gmdate_mod) {
|
2019-06-25 18:50:52 +00:00
|
|
|
$page->set_mode(PageMode::DATA);
|
2019-05-28 16:59:38 +00:00
|
|
|
$page->set_code(304);
|
|
|
|
$page->set_data("");
|
|
|
|
} else {
|
2019-06-25 18:50:52 +00:00
|
|
|
$page->set_mode(PageMode::FILE);
|
2019-05-28 16:59:38 +00:00
|
|
|
$page->add_http_header("Last-Modified: $gmdate_mod");
|
2019-06-14 12:47:50 +00:00
|
|
|
if ($type != "thumb") {
|
2019-06-25 18:50:52 +00:00
|
|
|
$page->set_filename($image->get_nice_image_name(), 'inline');
|
2019-06-14 12:47:50 +00:00
|
|
|
}
|
2019-06-25 18:50:52 +00:00
|
|
|
|
|
|
|
$page->set_file($file);
|
2019-10-02 10:23:57 +00:00
|
|
|
|
2019-06-18 18:45:59 +00:00
|
|
|
if ($config->get_int(ImageConfig::EXPIRES)) {
|
|
|
|
$expires = date(DATE_RFC1123, time() + $config->get_int(ImageConfig::EXPIRES));
|
2019-05-28 16:59:38 +00:00
|
|
|
} else {
|
|
|
|
$expires = 'Fri, 2 Sep 2101 12:42:42 GMT'; // War was beginning
|
|
|
|
}
|
2019-06-25 18:50:52 +00:00
|
|
|
$page->add_http_header('Expires: ' . $expires);
|
2019-05-28 16:59:38 +00:00
|
|
|
}
|
2020-06-16 23:40:13 +00:00
|
|
|
|
2020-06-16 23:40:13 +00:00
|
|
|
send_event(new ImageDownloadingEvent($image, $file, $mime));
|
2019-05-28 16:59:38 +00:00
|
|
|
} else {
|
|
|
|
$page->set_title("Not Found");
|
|
|
|
$page->set_heading("Not Found");
|
2019-06-25 18:50:52 +00:00
|
|
|
$page->add_block(new Block("Navigation", "<a href='" . make_link() . "'>Index</a>", "left", 0));
|
2019-05-28 16:59:38 +00:00
|
|
|
$page->add_block(new Block(
|
2020-10-26 15:15:20 +00:00
|
|
|
"Post not in database",
|
2019-05-28 16:59:38 +00:00
|
|
|
"The requested image was not found in the database"
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
2019-11-03 16:22:59 +00:00
|
|
|
}
|