Allowed types for image/file attributes
Permalink
I have site which has an customized page_list for news/event annoucements. The list shows images that are set for each page as an page attribure. The shown images are thumbnails of the actual files created with image helper's getThumbNail() function.
Is there any way to restrict files types that can be set for spesific image/file attribute? I just ran into a situation where customer had set an PDF file for page image attribute. This led to the PDF file to be parsed by getThumbNail and finally Apache getting jammed due to huge need for memory.
I got over the problem by checking that the file is an image file before trying to create a thumbnail. However, it would be easier for customer to be able to use only jpg/gif/png for the attribute. A friend of mine suggested creating a new attribute type that would only accept corresponding image files, but I'm not really sure how to do this (I'm just looking at the files in /concrete/models/attribute/...)
Any ideas?
Is there any way to restrict files types that can be set for spesific image/file attribute? I just ran into a situation where customer had set an PDF file for page image attribute. This led to the PDF file to be parsed by getThumbNail and finally Apache getting jammed due to huge need for memory.
I got over the problem by checking that the file is an image file before trying to create a thumbnail. However, it would be easier for customer to be able to use only jpg/gif/png for the attribute. A friend of mine suggested creating a new attribute type that would only accept corresponding image files, but I'm not really sure how to do this (I'm just looking at the files in /concrete/models/attribute/...)
Any ideas?