FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

rewrite imgix parameter q to fastly quality, while updating the values · devhttps/frontend@f7c607c · GitHub

Commit f7c607c

Browse files
committed
rewrite imgix parameter q to fastly quality, while updating the values
1 parent 16bc294 commit f7c607c

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎article/test/ArticleFeatureTest.scala‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ import collection.JavaConverters._
137137

138138
And("I should see the image url")
139139
el("[itemprop='associatedMedia image'] [itemprop=url]").attribute("content") should
140-
include("/img/static/sys-images/Guardian/Pix/pictures/2012/8/6/1344274684805/Gunnerside-village-Swaled-009.jpg?width=700&q=55&auto=format&usm=12&fit=max&s=")
140+
include("/img/static/sys-images/Guardian/Pix/pictures/2012/8/6/1344274684805/Gunnerside-village-Swaled-009.jpg?width=700&quality=85&auto=format&usm=12&fit=max&s=")
141141

142142
And("I should see the image width")
143143
el("[itemprop='associatedMedia image'] [itemprop=width]").attribute("content") should be("460")
@@ -405,7 +405,7 @@ import collection.JavaConverters._
405405

406406
And("video meta thumbnailUrl should be set")
407407
$("[itemprop='associatedMedia video'] [itemprop=thumbnailUrl]").attribute("content") should
408-
include("img/static/sys-images/Guardian/Pix/audio/video/2014/5/16/1400240928538/Nigel-Farage-LBC-debate-i-014.jpg?width=640&height=360&q=55&auto=format&usm=12&fit=max&s=")
408+
include("img/static/sys-images/Guardian/Pix/audio/video/2014/5/16/1400240928538/Nigel-Farage-LBC-debate-i-014.jpg?width=640&height=360&quality=85&auto=format&usm=12&fit=max&s=")
409409

410410
And("video meta uploadDate should be set")
411411
$("[itemprop='associatedMedia video'] [itemprop=uploadDate]").attribute("content") should be("2014-05-16T16:09:34.000+01:00")

‎common/app/views/support/Profile.scala‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ sealed trait ElementProfile {
4444
bestFor(image).flatMap(_.altText)
4545

4646
// NOTE - if you modify this in any way there is a decent chance that you decache all our images :(
47-
val qualityparam = if (hidpi) {"q=20"} else {"q=55"}
47+
val qualityparam = if (hidpi) {"quality=45"} else {"quality=85"}
4848
val autoParam = if (autoFormat) "auto=format" else ""
4949
val sharpParam = "usm=12"
5050
val fitParam = "fit=max"
@@ -107,7 +107,7 @@ object Video1280 extends VideoProfile(width = Some(1280), height = Some(720)) //
107107
object GoogleStructuredData extends Profile(width = Some(300), height = Some(300)) // 1:1
108108

109109
class ShareImage(blendImageParam: String, shouldIncludeOverlay: Boolean) extends Profile(width = Some(1200)) {
110-
override val heightParam = "h=630"
110+
override val heightParam = "height=630"
111111
override val fitParam = "fit=crop"
112112
val cropParam = "crop=faces%2Centropy"
113113
val blendModeParam = "bm=normal"
@@ -193,13 +193,13 @@ object FacebookOpenGraphImage extends OverlayBase64 {
193193
}
194194

195195
object EmailImage extends Profile(width = Some(580), autoFormat = false) {
196-
override val qualityparam = "q=40"
196+
override val qualityparam = "quality=60"
197197
val knownWidth = width.get
198198
}
199199

200200
object EmailVideoImage extends Profile(width = Some(580), autoFormat = false) with OverlayBase64 {
201201
override val fitParam = "fit=crop"
202-
override val qualityparam = "q=40"
202+
override val qualityparam = "quality=60"
203203
val blendModeParam = "bm=normal"
204204
val blendOffsetParam = "ba=center"
205205
val blendImageParam = s"blend64=${overlayUrlBase64("play.png")}"
@@ -211,15 +211,15 @@ object EmailVideoImage extends Profile(width = Some(580), autoFormat = false) wi
211211
}
212212

213213
object FrontEmailImage extends Profile(width = Some(500), autoFormat = false) {
214-
override val qualityparam = "q=40"
214+
override val qualityparam = "quality=60"
215215
val knownWidth = width.get
216216
}
217217

218218
object SmallFrontEmailImage {
219219
def apply(customWidth: Int): SmallFrontEmailImage = new SmallFrontEmailImage(customWidth)
220220
}
221221
class SmallFrontEmailImage(customWidth: Int) extends Profile(Some(customWidth), autoFormat = false) {
222-
override val qualityparam = "q=40"
222+
override val qualityparam = "quality=60"
223223
}
224224

225225
// The imager/images.js base image.

‎common/test/views/support/ImgSrcTest.scala‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ class ImgSrcTest extends FlatSpec with Matchers with GuiceOneAppPerSuite {
8484

8585
"ImgSrc" should "convert the URL of a static image to the resizing endpoint with a /static prefix" in {
8686
ImageServerSwitch.switchOn()
87-
Item700.bestSrcFor(image).get should startWith (s"$imageHost/img/static/sys-images/Guardian/Pix/pictures/2013/7/5/1373023097878/b6a5a492-cc18-4f30-9809-88467e07ebfa-460x276.jpeg?width=700&q=55&auto=format&usm=12&fit=max&s=")
87+
Item700.bestSrcFor(image).get should startWith (s"$imageHost/img/static/sys-images/Guardian/Pix/pictures/2013/7/5/1373023097878/b6a5a492-cc18-4f30-9809-88467e07ebfa-460x276.jpeg?width=700&quality=85&auto=format&usm=12&fit=max&s=")
8888
}
8989

9090
it should "convert the URL of a media service to the resizing endpoint with a /media prefix" in {
9191
ImageServerSwitch.switchOn()
92-
Item700.bestSrcFor(mediaImage).get should startWith (s"$imageHost/img/media/knly7wcp46fuadowlsnitzpawm/437_0_3819_2291/1000.jpg?width=700&q=55&auto=format&usm=12&fit=max&s=")
92+
Item700.bestSrcFor(mediaImage).get should startWith (s"$imageHost/img/media/knly7wcp46fuadowlsnitzpawm/437_0_3819_2291/1000.jpg?width=700&quality=85&auto=format&usm=12&fit=max&s=")
9393
}
9494

9595
it should "not convert the URL of the image if it is disabled" in {
@@ -100,13 +100,13 @@ class ImgSrcTest extends FlatSpec with Matchers with GuiceOneAppPerSuite {
100100
it should "convert the URL of the image if it is a PNG (original image from static.guim.co.uk domain)" in {
101101
ImageServerSwitch.switchOn()
102102
val pngImage = ImageMedia.apply(Seq(ImageAsset.make(asset.copy(file = Some("http://static.guim.co.uk/sys-images/Guardian/Pix/contributor/2014/10/30/1414675415419/Jessica-Valenti-R.png")),0)))
103-
Item700.bestSrcFor(pngImage).get should startWith (s"$imageHost/img/static/sys-images/Guardian/Pix/contributor/2014/10/30/1414675415419/Jessica-Valenti-R.png?width=700&q=55&auto=format&usm=12&fit=max&s=")
103+
Item700.bestSrcFor(pngImage).get should startWith (s"$imageHost/img/static/sys-images/Guardian/Pix/contributor/2014/10/30/1414675415419/Jessica-Valenti-R.png?width=700&quality=85&auto=format&usm=12&fit=max&s=")
104104
}
105105

106106
it should "convert the URL of the image if it is a PNG (original image from static-secure.guim.co.uk domain)" in {
107107
ImageServerSwitch.switchOn()
108108
val pngImage = ImageMedia.apply(Seq(ImageAsset.make(asset.copy(file = Some("http://static-secure.guim.co.uk/sys-images/Guardian/Pix/contributor/2014/10/30/1414675415419/Jessica-Valenti-R.png")),0)))
109-
Item700.bestSrcFor(pngImage).get should startWith (s"$imageHost/img/static/sys-images/Guardian/Pix/contributor/2014/10/30/1414675415419/Jessica-Valenti-R.png?width=700&q=55&auto=format&usm=12&fit=max&s=")
109+
Item700.bestSrcFor(pngImage).get should startWith (s"$imageHost/img/static/sys-images/Guardian/Pix/contributor/2014/10/30/1414675415419/Jessica-Valenti-R.png?width=700&quality=85&auto=format&usm=12&fit=max&s=")
110110
}
111111

112112
it should "not convert the URL of the image if it is a GIF (we do not support animated GIF)" in {
@@ -123,12 +123,12 @@ class ImgSrcTest extends FlatSpec with Matchers with GuiceOneAppPerSuite {
123123

124124
it should "convert the URL of a jpeg s3 upload to the resizing endpoint with a /uploads prefix" in {
125125
ImageServerSwitch.switchOn()
126-
Item700.bestSrcFor(s3UploadJpgImage).get should startWith (s"$imageHost/img/uploads/2016/02/10/Screen_Shot_2016-02-09_at_17.50.09.jpeg?width=700&q=55&auto=format&usm=12&fit=max&s=")
126+
Item700.bestSrcFor(s3UploadJpgImage).get should startWith (s"$imageHost/img/uploads/2016/02/10/Screen_Shot_2016-02-09_at_17.50.09.jpeg?width=700&quality=85&auto=format&usm=12&fit=max&s=")
127127
}
128128

129129
it should "convert the URL of a png s3 upload to the resizing endpoint with a /uploads prefix" in {
130130
ImageServerSwitch.switchOn()
131-
Item700.bestSrcFor(s3UploadPNGImage).get should startWith (s"$imageHost/img/uploads/2016/02/04/gu.png?width=700&q=55&auto=format&usm=12&fit=max&s=")
131+
Item700.bestSrcFor(s3UploadPNGImage).get should startWith (s"$imageHost/img/uploads/2016/02/04/gu.png?width=700&quality=85&auto=format&usm=12&fit=max&s=")
132132
}
133133

134134
it should "not convert the URL of a gif s3 upload (we do not support animated GIF)" in {

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL