Closed flashvnn closed 5 years ago
@flashvnn you need to specify extensions ...
FILE('/image/style/thumbnail/', image_thumbnail, ['*.jpg', '.png', '.gif']);
or
FILE('/image/style/thumbnail/*.jpg', image_thumbnail);
or for all files:
FILE('/image/style/thumbnail/*.*', image_thumbnail);
Thanks for your fast reply, My issue is when user load image like /image/style/thumbnail/B20190701T000000039.jpg and if the file with ID B20190701T000000039 doesn't exist or removed in FILE_STORAGE , i want return other image instead of throw 404 page.
This can be handle via system route 404
only:
ROUTE('#404', function() {
var self = this;
var compare = '/image/style/thumbnail/';
if (self.uri.pathname.substring(0, compare.length) === compare) {
// DEFAULT IMAGE
self.file('YOUR_FILE_FROM_PUBLIC_DIRECTORY');
} else {
self.status = 404;
self.plain('404: Resource not found');
}
});
In other words: if the file won't exist then the framework executes #404
route.
It work great, thanks you.
i use code bellow to display thumbnail for image,
Everything work fine, when image doesn't exist it throw 404 page. How i can return a default image placed in public folder when image doesn't exist?