What's the best way to handle images when working with a database?

What’s the best way to handle images when working with a database?

When i use images, the system creates folders for each newsitem with the image inside.

But this slows down my page because the system still uses the folders to search for the images($page->images() or $page->mydbimg()->tofile()). So the benefits of using a database (speed) dissapears.

Is there another (faster) way or a special trick :slight_smile: ?

(I have a table with some newsitems with an image for each newsitem. On the global newspage i have a grid of the newsitems with an image).

thanks.

I guess you would have to store the image in the database. But I don’t really know how to intercept the Panel upload so that the file is not store on disk, maybe in the absence of file models using a route:before hook?

Do you have a little more info of what you would do in the route:before hook? :thinking:

No, unfortunately not, would have to try that out myself first… Basically, you would listen to the file create route and then act from there.

But this is only an idea, maybe there is a better way to go about this.