2 Commits

Author SHA1 Message Date
a9a6ab3207 remove hook for update post
this was leftover from when i was updating the featured image
2024-05-17 11:14:39 +00:00
8c0b1e3c19 check for image_path exists and set http status header 2024-05-16 16:07:20 -05:00

View File

@@ -6,8 +6,6 @@ Version: 1.0
Author: Your Name
*/
add_action('save_post_sp_event', 'generate_event_featured_image', 10, 3);
function generate_bisected_image($color1, $color2, $logo1_path, $logo2_path) {
$width = 1200;
$height = 628;
@@ -184,6 +182,17 @@ add_action('template_redirect', 'handle_image_request');
function serve_image($image_path) {
header('Content-Type: image/png');
if (file_exists($image_path)) {
status_header( 200 );
} else {
status_header( 404 );
die("Image not found.");
}
// Clear all output buffering to prevent any extra output
while (ob_get_level()) {
ob_end_clean();
}
readfile($image_path);
}