diff --git a/core/models/profiles.py b/core/models/profiles.py index f9e297a3..0bb6e11b 100644 --- a/core/models/profiles.py +++ b/core/models/profiles.py @@ -449,21 +449,20 @@ def crop_photo(self): def process_photo(self): if self.full_photo: - size_modified = False try: img = Image.open(self.full_photo) except Exception as e: raise e - if img.height > 1200 or img.width > 1200: - new_size = (1200, 1200) - img.thumbnail(new_size) - img.save(self.full_photo.path) - size_modified = True + # if img.height > 1200 or img.width > 1200: + # new_size = (1200, 1200) + # img.thumbnail(new_size) + # img.save(self.full_photo.path) + # size_modified = True if not self.cropped_photo: - if size_modified: - img = Image.open(self.full_photo) + # if size_modified: + # img = Image.open(self.full_photo) distance = int(0.95 * min([img.height, img.width])) self.crop_width, self.crop_height = distance, distance self.crop_x = int((img.width - distance) / 2) @@ -475,13 +474,7 @@ def has_photo(self): to_check = getattr(getattr(self, "cropped_photo"), "name") return to_check != "" and to_check is not None - @cached_property - def photo_path_old(self): - if self.has_photo: - return self.cropped_photo.path - - @cached_property - def photo_path(self): + def get_photo_path(self): if self.has_photo: self.cropped_photo.seek(0) photobytes = self.cropped_photo.read() diff --git a/tex_templates/cvs/Alice/template.tex b/tex_templates/cvs/Alice/template.tex index 0ef927d4..e22550b8 100644 --- a/tex_templates/cvs/Alice/template.tex +++ b/tex_templates/cvs/Alice/template.tex @@ -6,7 +6,7 @@ %---------------------------------------------------------------------------------------- % photo {% if profile.has_photo and profile.photo_active %} - \photo{\includegraphics[width=\imagewidth]{ {{- profile.photo_path -}} } } + \photo{\includegraphics[width=\imagewidth]{ {{- profile.get_photo_path() -}} } } {% else %} \photo{} {% endif %} diff --git a/tex_templates/cvs/Krieger/template.tex b/tex_templates/cvs/Krieger/template.tex index b5da29ad..3f52fe3d 100644 --- a/tex_templates/cvs/Krieger/template.tex +++ b/tex_templates/cvs/Krieger/template.tex @@ -46,7 +46,7 @@ {% endif %} % photo {% if profile.has_photo and profile.photo_active %} - \photo[round]{ {{- profile.photo_path -}} }{\dimexpr \headerheight-\marginbottom} % Profile picture + \photo[round]{ {{- profile.get_photo_path() -}} }{\dimexpr \headerheight-\marginbottom} % Profile picture {% else %} \photo[round]{picture.jpg}{\dimexpr \headerheight-\marginbottom} % Profile picture {% endif %} diff --git a/tex_templates/cvs/Marissa/template.tex b/tex_templates/cvs/Marissa/template.tex index a7ec1e04..929550ed 100644 --- a/tex_templates/cvs/Marissa/template.tex +++ b/tex_templates/cvs/Marissa/template.tex @@ -84,7 +84,7 @@ %% You can add multiple photos on the left (\photoL) or right (\photoR) {% if profile.has_photo and profile.photo_active %} -\photoR{2.5cm}{ {{- profile.photo_path -}} } +\photoR{2.5cm}{ {{- profile.get_photo_path() -}} } {% endif %} \personalinfo{ diff --git a/tex_templates/cvs/Modern/template.tex b/tex_templates/cvs/Modern/template.tex index 6215c5bb..e3b9982d 100644 --- a/tex_templates/cvs/Modern/template.tex +++ b/tex_templates/cvs/Modern/template.tex @@ -41,7 +41,7 @@ \usepackage[english]{babel} % FIXME: using spanish breaks moderncv % personal data -\name{John}{Doe} +\name{ {{- profile.get_tex_value("fullname") -}} }{} \title{Résumé title} % optional, remove / comment the line if not wanted \born{4 July 1776} % optional, remove / comment the line if not wanted \address{street and number}{postcode city}{country}% optional, remove / comment the line if not wanted; the "postcode city" and "country" arguments can be omitted or provided empty