File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
djangocms_frontend/contrib/image Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -120,8 +120,9 @@ def img_src(self):
120120 # in this case we want to return an empty string to avoid #69
121121 elif not self .picture :
122122 return ""
123- # skip image processing when there's no width or height defined
124- elif not self .width and not self .height :
123+ # skip image processing when there's no width or height defined,
124+ # or when legacy use_no_cropping flag is present
125+ elif getattr (self , 'use_no_cropping' , None ) or not (self .width or self .height ):
125126 return self .rel_image .url if self .rel_image else ""
126127
127128 picture_options = self .get_size (
Original file line number Diff line number Diff line change @@ -103,6 +103,28 @@ def test_img_processing(self):
103103 self .assertEqual (response .status_code , 200 )
104104 self .assertContains (response , '/test_file.jpg"' )
105105
106+ # Original image also used if legacy use_no_cropping flag is present,
107+ # even when there is widht and height
108+ plugin = add_plugin (
109+ placeholder = self .placeholder ,
110+ plugin_type = ImagePlugin .__name__ ,
111+ language = self .language ,
112+ config = {
113+ "picture" : {"pk" : self .image .id , "model" : "filer.Image" },
114+ "width" : 50 ,
115+ "height" : 100 ,
116+ "use_no_cropping" : True ,
117+ },
118+ )
119+ plugin .initialize_from_form (ImageForm )
120+ plugin .save ()
121+ self .publish (self .page , self .language )
122+
123+ with self .login_user_context (self .superuser ):
124+ response = self .client .get (self .request_url )
125+ self .assertEqual (response .status_code , 200 )
126+ self .assertContains (response , '/test_file.jpg"' )
127+
106128 def test_image_form (self ):
107129 request = HttpRequest ()
108130 request .POST = {
You can’t perform that action at this time.
0 commit comments