<?php

use JetBrains\PhpStorm\NoReturn;

class dropimagefile extends dropimage {
	
	#[NoReturn] public static function getById(int $id): ?array {
		$img=dropimage::getById($id);
		$file=fopen($img['imagestorepath'].$img['imagepath'],'rb');
		header('Content-Type: image/jpeg');
		fpassthru($file);
		fclose($file);
		exit;
	}

	public static function getByName(string $name): ?array {
		return dropimage::getByName($name);
	}

	public static function getByNameLike(string $searchTerms, array $request=[]): ?array {
		return dropimage::getByNameLike($searchTerms, $request);
	}

	public static function getByProperty(string $key, string $value, array $request=[]): array {
		return dropimage::getByProperty($key, $value, $request);
	}

	public static function getByProperties(array $keyValuePairs, array $request=[]): array {
		return dropimage::getByProperties($keyValuePairs, $request);
	}

	public static function create(array $request=[]): array {
		throw new BadRequestException('Create a dropimage instead');
	}
	public static function update(int $id,array $request=[]): array {
		throw new BadRequestException('Update the dropimage instead');
	}
	public static function delete(int $id): array {
		throw new BadRequestException('Delete the dropimage instead');
	}
	
}