Skip to content

Commit

Permalink
Ugly hack to temporary disable thumbnail generation for tiff files
Browse files Browse the repository at this point in the history
  • Loading branch information
superalex committed May 25, 2016
1 parent a7dfec1 commit e295bd9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions taiga/base/utils/thumbnails.py
Expand Up @@ -15,13 +15,26 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os

from django.db.models.fields.files import FieldFile

from taiga.base.utils.urls import get_absolute_url

from easy_thumbnails.files import get_thumbnailer
from easy_thumbnails.exceptions import InvalidImageFormatError


def get_thumbnail_url(file_obj, thumbnailer_size):
# Ugly hack to temporary ignore tiff files
relative_name = file_obj
if isinstance(file_obj, FieldFile):
relative_name = file_obj.name

source_extension = os.path.splitext(relative_name)[1][1:]
if source_extension == "tiff":
return None

try:
path_url = get_thumbnailer(file_obj)[thumbnailer_size].url
thumb_url = get_absolute_url(path_url)
Expand Down

0 comments on commit e295bd9

Please sign in to comment.