Skip to content

Commit fe68fa2

Browse files
Merge pull request #2359 from NCCE/3013-remove-loremflickr
Removing LoremFlickr
2 parents c20567f + 4d4737d commit fe68fa2

File tree

6 files changed

+23
-8
lines changed

6 files changed

+23
-8
lines changed

app/helpers/cms_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module CmsHelper
22
def cms_url(url)
33
if Rails.env.development?
4-
return url if url.starts_with?("http")
4+
return url if url.starts_with?("http") || url.starts_with?("/test-images")
55
"#{Rails.application.config.strapi_image_url}#{url}"
66
else
77
url

app/services/cms/providers/strapi/mocks/image.rb

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,25 @@ module Providers
33
module Strapi
44
module Mocks
55
class Image
6+
include ActionView::Helpers::AssetUrlHelper
7+
68
SIZES = {
7-
medium: [750, 500],
8-
small: [500, 300],
9-
thumbnail: [250, 100]
9+
large: {
10+
size: [1000, 800],
11+
url: "/test-images/large_test.png"
12+
},
13+
medium: {
14+
size: [750, 500],
15+
url: "/test-images/medium_test.png"
16+
},
17+
small: {
18+
size: [500, 300],
19+
url: "/test-images/small_test.png"
20+
},
21+
thumbnail: {
22+
size: [250, 100],
23+
url: "/test-images/thumbail_test.png"
24+
}
1025
}
1126

1227
def self.as_model(caption: nil)
@@ -40,20 +55,20 @@ def self.generate_data(caption: nil)
4055
ext: ".png",
4156
mime: "image/png",
4257
size: 137.23,
43-
url: Faker::LoremFlickr.image(size: "1000x800")
58+
url: SIZES[:large][:url]
4459
}
4560
end
4661

4762
def self.format(name, hash_name, size)
4863
{
4964
ext: ".png",
50-
url: Faker::LoremFlickr.image(size: SIZES[size].join("x")),
65+
url: SIZES[size][:url],
5166
hash: hash_name,
5267
mime: "image/png",
5368
name: name,
5469
size: 390.03,
55-
width: SIZES[size][0],
56-
height: SIZES[size][1],
70+
width: SIZES[size][:size][0],
71+
height: SIZES[size][:size][1],
5772
sizeInBytes: 390028
5873
}
5974
end

public/test-images/large_test.png

18.7 KB
Loading

public/test-images/medium_test.png

16.8 KB
Loading

public/test-images/small_test.png

15.4 KB
Loading
18.8 KB
Loading

0 commit comments

Comments
 (0)