Compare commits

..

No commits in common. "c5b4dda9507dc0b2fa19b090d94f5d5653ad7490" and "3c1f996342ab02e15a9583bbb04fa1261d476c83" have entirely different histories.

2 changed files with 6 additions and 10 deletions

View File

@ -86,9 +86,8 @@ function create_thumbnail(string $category, string $file): string | null {
log_print("generating thumbnail for $original_file"); log_print("generating thumbnail for $original_file");
$output = shell_exec(THUMBNAIL_SCRIPT." '$original_file' '$thumbnail_file' 2>&1"); $output = shell_exec(THUMBNAIL_SCRIPT." '$original_file' '$thumbnail_file' 2>&1");
if ($output) log_print($output); if ($output) log_print($output);
if (substr_count(strtolower((string) $output), "error")) { if ($output === false) {
log_error("Thumbnail failed"); log_error("Thumbnail failed");
log_print(ROOT_URL.IMG_DIR.$path);
return ROOT_URL.IMG_DIR.$path; return ROOT_URL.IMG_DIR.$path;
} }

View File

@ -5,11 +5,12 @@ import sys
def main(): def main():
argn = len(sys.argv) argn = len(sys.argv)
if argn == 1: if argn == 1:
print_error("You must specify an input file") print("Error: You must specify an input file")
exit(1) exit(1)
elif argn == 2: elif argn == 2:
print_error("You must specify an output file") print("Error: You must specify an output file")
exit(1) exit(1)
input_image_path = sys.argv[1] input_image_path = sys.argv[1]
@ -18,7 +19,7 @@ def main():
try: try:
image = Image.open(input_image_path) image = Image.open(input_image_path)
except IOError: except IOError:
print_error(f"Cannot open image file {input_image_path}") print(f"Error: Cannot open image file {input_image_path}")
image.close() image.close()
exit(1) exit(1)
@ -36,15 +37,11 @@ def main():
try: try:
image.save(output_image_path, **kwargs) image.save(output_image_path, **kwargs)
except IOError: except IOError:
print_error(f"Cannot save file {output_image_path}") print(f"Error: Cannot save file {output_image_path}")
image.close() image.close()
exit(1) exit(1)
def print_error(string):
print(f"resize-img Error: {string}")
def rotate_image(image): def rotate_image(image):
exif = image.getexif() exif = image.getexif()
if exif is None: if exif is None: