html_to 1.1.1 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/html_to/chromium.rb +1 -1
- data/lib/html_to/image_generate.rb +2 -2
- data/lib/html_to/version.rb +1 -1
- data/lib/html_to.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ceac4dec6528406e6321819377493c1b18f9cebbadd3455fd307b4babfe3e2f
|
4
|
+
data.tar.gz: 97890c3c9aaceb21cb39a8cdedf111a67e9302cff993583335e7ade6ae373081
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a63d7c78827ff4e2d9de2fb3aca915e9af25789e682986ccbebfa71f4918443cdf7b76af881a39fb802ccf3cb1c30e70ab0451fdf5cd1fd0f047ae4168571060
|
7
|
+
data.tar.gz: 1458eb7e8ca497b7c7ac9317de7149d4fd80d8b736be49c211b58eb4caf29b6cec2f5289b1dae185b9a86b0ac3121914dab54e847e9b5261b62b9e1ed1c99520
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ HtmlTo is a gem for Rails that allows you to generate images from an HTML file.
|
|
15
15
|
|
16
16
|
## Installation
|
17
17
|
|
18
|
-
You need to have Chrome or Chromium installed 🛠️
|
18
|
+
You need to have Chrome or Chromium installed 🛠️ And active-storage is required
|
19
19
|
|
20
20
|
|
21
21
|
Ubuntu:
|
@@ -44,6 +44,8 @@ HtmlTo::Configuration.config do |config|
|
|
44
44
|
end
|
45
45
|
```
|
46
46
|
|
47
|
+
to optimize attached images add `gem 'image_processing'`
|
48
|
+
|
47
49
|
## Basic usage
|
48
50
|
Add to your model 📖
|
49
51
|
|
data/lib/html_to/chromium.rb
CHANGED
@@ -9,7 +9,7 @@ module HtmlTo
|
|
9
9
|
end
|
10
10
|
|
11
11
|
path = if /darwin/.match?(RbConfig::CONFIG['host_os'])
|
12
|
-
|
12
|
+
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
|
13
13
|
elsif /linux/.match?(RbConfig::CONFIG['host_os'])
|
14
14
|
release = %x(lsb_release -i -s)
|
15
15
|
%x(which chromium-browser)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require_relative 'chromium'
|
3
3
|
require 'erb'
|
4
|
-
|
4
|
+
require 'shellwords'
|
5
5
|
class HtmlTo::ImageGenerate
|
6
6
|
include HtmlTo::Chromium
|
7
7
|
def call(record, serializer, options)
|
@@ -26,7 +26,7 @@ class HtmlTo::ImageGenerate
|
|
26
26
|
|
27
27
|
def take_screenshot(width, height)
|
28
28
|
cmd = <<~BASH.chomp
|
29
|
-
#{HtmlTo::Chromium.execute_path} \
|
29
|
+
#{HtmlTo::Chromium.execute_path.shellescape} \
|
30
30
|
--headless \
|
31
31
|
--screenshot=#{screenshot_file_path} \
|
32
32
|
--window-size=#{width},#{height} \
|
data/lib/html_to/version.rb
CHANGED
data/lib/html_to.rb
CHANGED
@@ -104,7 +104,7 @@ module HtmlTo
|
|
104
104
|
base.instance_eval do
|
105
105
|
alias_method :create_meta_image!, :html_to_create_meta_image! unless method_defined? :create_meta_images!
|
106
106
|
end
|
107
|
-
base.
|
107
|
+
base.after_save_commit :html_to_create_meta_image!, unless: :html_to_skip_meta_image_generate
|
108
108
|
end
|
109
109
|
|
110
110
|
def html_to_create_meta_image!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html_to
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chekryzhov Viktor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|