mini_magick 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mini_magick might be problematic. Click here for more details.
- data/History.txt +5 -0
- data/Manifest.txt +14 -0
- data/{README → README.txt} +41 -12
- data/Rakefile +15 -66
- data/init.rb +2 -0
- data/lib/image_temp_file.rb +13 -0
- data/lib/mini_magick.rb +73 -65
- data/test/not_an_image.php +420 -420
- data/test/test_image_temp_file.rb +14 -0
- data/test/{mini_magick_test.rb → test_mini_magick_test.rb} +0 -0
- metadata +38 -20
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
MIT-LICENSE
|
2
|
+
History.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.txt
|
5
|
+
Rakefile
|
6
|
+
init.rb
|
7
|
+
lib/image_temp_file.rb
|
8
|
+
lib/mini_magick.rb
|
9
|
+
test/actually_a_gif.jpg
|
10
|
+
test/not_an_image.php
|
11
|
+
test/simple.gif
|
12
|
+
test/test_image_temp_file.rb
|
13
|
+
test/test_mini_magick_test.rb
|
14
|
+
test/trogdor.jpg
|
data/{README → README.txt}
RENAMED
@@ -1,10 +1,13 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
mini_magick
|
2
|
+
by Coery Johnson
|
3
|
+
FIX (url)
|
3
4
|
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
4
7
|
A ruby wrapper for ImageMagick command line.
|
5
8
|
|
6
|
-
Why?
|
7
|
-
|
9
|
+
- Why?
|
10
|
+
|
8
11
|
I was using RMagick and loving it, but it was eating up huge amounts of memory. A simple script like this...
|
9
12
|
|
10
13
|
Magick::read("image.jpg") do |f|
|
@@ -13,14 +16,16 @@ end
|
|
13
16
|
|
14
17
|
...would use over 100 Megs of Ram. On my local machine this wasn't a problem, but on my hosting server the ruby apps would crash because of their 100 Meg memory limit.
|
15
18
|
|
16
|
-
Solution!
|
17
|
-
|
19
|
+
- Solution!
|
20
|
+
|
18
21
|
Using MiniMagick the ruby processes memory remains small (it spawns ImageMagick's command line program mogrify which takes up some memory as well, but is much smaller compared to RMagick)
|
19
22
|
|
23
|
+
|
24
|
+
== FEATURES/PROBLEMS:
|
25
|
+
|
20
26
|
MiniMagick gives you access to all the commandline options ImageMagick has (Found here http://www.imagemagick.org/script/mogrify.php)
|
21
27
|
|
22
|
-
|
23
|
-
--------
|
28
|
+
== SYNOPSIS:
|
24
29
|
|
25
30
|
Want to make a thumbnail from a file...
|
26
31
|
|
@@ -55,12 +60,13 @@ image[:width] # will get the width (you can also use :height and :format)
|
|
55
60
|
image["EXIF:BitsPerSample"] # It also can get all the EXIF tags
|
56
61
|
image["%m:%f %wx%h"] # Or you can use one of the many options of the format command found here http://www.imagemagick.org/script/command-line-options.php#format
|
57
62
|
|
58
|
-
|
59
|
-
|
63
|
+
|
64
|
+
== REQUIREMENTS:
|
65
|
+
|
60
66
|
You must have ImageMagick installed.
|
61
67
|
|
62
|
-
|
63
|
-
|
68
|
+
== INSTALL:
|
69
|
+
|
64
70
|
If you downloaded the plugin version, just drop the plugin into RAILS_ROOT/plugins/
|
65
71
|
|
66
72
|
If you installed this as a gem, then to get it to work add <require "mini_magick"> to RAILS_ROOT/config/environment.rb
|
@@ -69,4 +75,27 @@ If you have just downloaded this files then copy the mini_magick.rb file into yo
|
|
69
75
|
|
70
76
|
MiniMagick does NOT require rails though. All the code you need to use MiniMagick is located in the mini_magick/lib/mini_magick.rb file.
|
71
77
|
|
78
|
+
== LICENSE:
|
79
|
+
|
80
|
+
(The MIT License)
|
81
|
+
|
82
|
+
Copyright (c) 2007 FIX
|
83
|
+
|
84
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
85
|
+
a copy of this software and associated documentation files (the
|
86
|
+
'Software'), to deal in the Software without restriction, including
|
87
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
88
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
89
|
+
permit persons to whom the Software is furnished to do so, subject to
|
90
|
+
the following conditions:
|
91
|
+
|
92
|
+
The above copyright notice and this permission notice shall be
|
93
|
+
included in all copies or substantial portions of the Software.
|
72
94
|
|
95
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
96
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
97
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
98
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
99
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
100
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
101
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,68 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
task :default => :test
|
16
|
-
|
17
|
-
desc "Clean generated files"
|
18
|
-
task :clean do
|
19
|
-
rm FileList['test/output/*.png']
|
20
|
-
rm_rf 'pkg'
|
21
|
-
rm_rf 'doc'
|
22
|
-
end
|
23
|
-
|
24
|
-
desc 'Test the mini_magick plugin.'
|
25
|
-
Rake::TestTask.new(:test) do |t|
|
26
|
-
t.libs << 'lib'
|
27
|
-
t.pattern = 'test/**/*_test.rb'
|
28
|
-
t.verbose = true
|
29
|
-
end
|
30
|
-
|
31
|
-
desc 'Generate documentation for the mini_magick plugin.'
|
32
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
33
|
-
rdoc.rdoc_dir = 'rdoc'
|
34
|
-
rdoc.title = 'MiniMagick'
|
35
|
-
rdoc.options << '--line-numbers --inline-source'
|
36
|
-
rdoc.rdoc_files.include('README')
|
37
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/mini_magick.rb'
|
6
|
+
|
7
|
+
Hoe.new('mini_magick', MiniMagick::VERSION) do |p|
|
8
|
+
p.rubyforge_name = 'mini_magick'
|
9
|
+
p.author = 'Corey Johnson'
|
10
|
+
p.email = 'probablycorey+ruby@gmail.com'
|
11
|
+
p.summary = 'A simple image manipulation library based on ImageMagick.'
|
12
|
+
p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
|
13
|
+
#p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
|
14
|
+
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
38
15
|
end
|
39
16
|
|
40
|
-
|
41
|
-
# Create compressed packages
|
42
|
-
spec = Gem::Specification.new do |s|
|
43
|
-
s.platform = Gem::Platform::RUBY
|
44
|
-
s.name = PKG_NAME
|
45
|
-
s.summary = "Manipulate images with minimal use of memory."
|
46
|
-
s.description = %q{Uses command-line ImageMagick tools to resize, rotate, and mogrify images.}
|
47
|
-
s.version = PKG_VERSION
|
48
|
-
|
49
|
-
s.author = "Corey Johnson"
|
50
|
-
s.email = "probablycorey@gmail.com"
|
51
|
-
s.rubyforge_project = PKG_NAME
|
52
|
-
s.homepage = "http://gleepglop.com"
|
53
|
-
|
54
|
-
s.has_rdoc = true
|
55
|
-
s.requirements << 'none'
|
56
|
-
s.require_path = 'lib'
|
57
|
-
s.autorequire = 'mini_magick'
|
58
|
-
|
59
|
-
s.files = [ "Rakefile", "README", "MIT-LICENSE" ]
|
60
|
-
s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
61
|
-
s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) || item.include?("\.png") }
|
62
|
-
end
|
63
|
-
|
64
|
-
Rake::GemPackageTask.new(spec) do |p|
|
65
|
-
p.gem_spec = spec
|
66
|
-
p.need_tar = false
|
67
|
-
p.need_zip = true
|
68
|
-
end
|
17
|
+
# vim: syntax=Ruby
|
data/init.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "tempfile"
|
2
|
+
|
3
|
+
module MiniMagick
|
4
|
+
class ImageTempFile < Tempfile
|
5
|
+
def make_tmpname(basename, n)
|
6
|
+
# force tempfile to use basename's extension if provided
|
7
|
+
ext = File.extname(basename)
|
8
|
+
|
9
|
+
# force hyphens instead of periods in name
|
10
|
+
sprintf('%s%d-%d%s', File.basename(basename, ext), $$, n, ext)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/mini_magick.rb
CHANGED
@@ -1,52 +1,60 @@
|
|
1
|
+
# Changes
|
2
|
+
# 1.) all image commands return the image object (The output of the last command is saved in output)
|
3
|
+
# 2.) identify doesn't trip over strangly named files
|
4
|
+
# 3.) TempFile uses file extention now (Thanks http://marsorange.com/archives/of-mogrify-ruby-tempfile-dynamic-class-definitions)
|
5
|
+
|
1
6
|
require "open-uri"
|
2
|
-
require "tempfile"
|
3
7
|
require "stringio"
|
4
8
|
require "fileutils"
|
5
9
|
|
10
|
+
require File.join(File.dirname(__FILE__), '/image_temp_file')
|
11
|
+
|
6
12
|
module MiniMagick
|
7
|
-
class MiniMagickError <
|
8
|
-
|
9
|
-
VERSION = '1.2.
|
10
|
-
|
13
|
+
class MiniMagickError < RuntimeError; end
|
14
|
+
|
15
|
+
VERSION = '1.2.1'
|
16
|
+
|
11
17
|
class Image
|
12
18
|
attr :path
|
19
|
+
attr :output
|
13
20
|
|
14
21
|
# Class Methods
|
15
22
|
# -------------
|
16
23
|
class <<self
|
17
|
-
def from_blob(blob)
|
24
|
+
def from_blob(blob)
|
18
25
|
begin
|
19
|
-
tmp =
|
20
|
-
tmp.binmode
|
21
|
-
tmp.write(blob)
|
26
|
+
@tmp = ImageTempFile.new("minimagick") # Keep reference to the tempfile so garbage collection doesn't destroy it
|
27
|
+
@tmp.binmode
|
28
|
+
@tmp.write(blob)
|
22
29
|
ensure
|
23
|
-
tmp.close
|
24
|
-
end
|
25
|
-
return self.new(tmp.path)
|
30
|
+
@tmp.close
|
31
|
+
end
|
32
|
+
return self.new(@tmp.path)
|
26
33
|
end
|
27
|
-
|
34
|
+
|
28
35
|
# Use this if you don't want to overwrite the image file
|
29
|
-
def from_file(image_path)
|
36
|
+
def from_file(image_path)
|
30
37
|
File.open(image_path, "rb") do |f|
|
31
38
|
self.from_blob(f.read)
|
32
39
|
end
|
33
40
|
end
|
34
41
|
end
|
35
|
-
|
42
|
+
|
36
43
|
# Instance Methods
|
37
|
-
# ----------------
|
38
|
-
def initialize(input_path)
|
44
|
+
# ----------------
|
45
|
+
def initialize(input_path)
|
39
46
|
@path = input_path
|
40
|
-
|
47
|
+
|
41
48
|
# Ensure that the file is an image
|
42
|
-
run_command("identify
|
49
|
+
run_command("identify", @path)
|
43
50
|
end
|
44
|
-
|
51
|
+
|
52
|
+
# For reference see http://www.imagemagick.org/script/command-line-options.php#format
|
45
53
|
def [](value)
|
46
|
-
# Why do I go to the trouble of putting in
|
54
|
+
# Why do I go to the trouble of putting in newlines? Because otherwise animated gifs screw everything up
|
47
55
|
case value.to_s
|
48
56
|
when "format"
|
49
|
-
run_command("identify", "-format", format_option("%m"), @path).split("\n")[0]
|
57
|
+
run_command("identify", "-format", format_option("%m"), @path).split("\n")[0]
|
50
58
|
when "height"
|
51
59
|
run_command("identify", "-format", format_option("%h"), @path).split("\n")[0].to_i
|
52
60
|
when "width"
|
@@ -55,87 +63,87 @@ module MiniMagick
|
|
55
63
|
# Get the EXIF original capture as a Time object
|
56
64
|
Time.local(*self["EXIF:DateTimeOriginal"].split(/:|\s+/)) rescue nil
|
57
65
|
when /^EXIF\:/i
|
58
|
-
run_command('identify', '-format', "\"%[#{value}]\"", @path).chop
|
66
|
+
run_command('identify', '-format', "\"%[#{value}]\"", @path).chop
|
59
67
|
else
|
60
|
-
run_command('identify', '-format', "\"#{value}\"", @path)
|
68
|
+
run_command('identify', '-format', "\"#{value}\"", @path).split("\n")[0]
|
61
69
|
end
|
62
70
|
end
|
63
|
-
|
71
|
+
|
64
72
|
# This is a 'special' command because it needs to change @path to reflect the new extension
|
65
73
|
def format(format)
|
66
74
|
run_command("mogrify", "-format", format, @path)
|
67
|
-
@path = @path.sub(
|
75
|
+
@path = @path.sub(/(\.\w+)?$/, ".#{format}")
|
68
76
|
|
69
77
|
raise "Unable to format to #{format}" unless File.exists?(@path)
|
70
78
|
end
|
71
|
-
|
79
|
+
|
72
80
|
# Writes the temporary image that we are using for processing to the output path
|
73
|
-
def write(output_path)
|
81
|
+
def write(output_path)
|
74
82
|
FileUtils.copy_file @path, output_path
|
75
|
-
run_command "identify #{output_path}"
|
83
|
+
run_command "identify #{output_path}" # Verify that we have a good image
|
76
84
|
end
|
77
|
-
|
85
|
+
|
86
|
+
# Give you raw data back
|
87
|
+
def to_blob
|
88
|
+
File.read @path
|
89
|
+
end
|
90
|
+
|
78
91
|
# If an unknown method is called then it is sent through the morgrify program
|
79
92
|
# Look here to find all the commands (http://www.imagemagick.org/script/mogrify.php)
|
80
93
|
def method_missing(symbol, *args)
|
81
94
|
args.push(@path) # push the path onto the end
|
82
95
|
run_command("mogrify", "-#{symbol}", *args)
|
96
|
+
self
|
83
97
|
end
|
84
|
-
|
98
|
+
|
85
99
|
# You can use multiple commands together using this method
|
86
|
-
def combine_options(&block)
|
100
|
+
def combine_options(&block)
|
87
101
|
c = CommandBuilder.new
|
88
102
|
block.call c
|
89
103
|
run_command("mogrify", *c.args << @path)
|
90
104
|
end
|
91
|
-
|
92
|
-
#
|
93
|
-
# -----------------------------
|
94
|
-
private
|
95
|
-
|
96
|
-
# Check to see if we are running on win32 -- we need to escape things differently
|
105
|
+
|
106
|
+
# Check to see if we are running on win32 -- we need to escape things differently
|
97
107
|
def windows?
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
# Outputs a carriage-return delimited format string for Unix and Windows
|
108
|
+
!(RUBY_PLATFORM =~ /win32/).nil?
|
109
|
+
end
|
110
|
+
|
111
|
+
# Outputs a carriage-return delimited format string for Unix and Windows
|
102
112
|
def format_option(format)
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
format = "#{format}\\\\n"
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
113
|
+
windows? ? "#{format}\\n" : "#{format}\\\\n"
|
114
|
+
end
|
115
|
+
|
110
116
|
def run_command(command, *args)
|
111
|
-
args
|
112
|
-
|
113
|
-
unless
|
114
|
-
|
115
|
-
else
|
116
|
-
a
|
117
|
-
end
|
117
|
+
args.collect! do |arg|
|
118
|
+
arg = arg.to_s
|
119
|
+
arg = %|"#{arg}"| unless arg[0] == ?- # values quoted because they can contain characters like '>', but don't quote switches
|
120
|
+
arg
|
118
121
|
end
|
119
|
-
|
120
|
-
output = `#{command} #{args.join(' ')}`
|
121
|
-
|
122
|
+
|
123
|
+
@output = `#{command} #{args.join(' ')}`
|
124
|
+
|
122
125
|
if $? != 0
|
123
126
|
raise MiniMagickError, "ImageMagick command (#{command} #{args.join(' ')}) failed: Error Given #{$?}"
|
124
127
|
else
|
125
|
-
|
126
|
-
end
|
128
|
+
@output
|
129
|
+
end
|
127
130
|
end
|
128
131
|
end
|
129
132
|
|
130
133
|
class CommandBuilder
|
131
134
|
attr :args
|
132
|
-
|
135
|
+
|
133
136
|
def initialize
|
134
137
|
@args = []
|
135
138
|
end
|
136
|
-
|
139
|
+
|
137
140
|
def method_missing(symbol, *args)
|
138
|
-
@args
|
139
|
-
|
141
|
+
@args << "-#{symbol}"
|
142
|
+
@args += args
|
143
|
+
end
|
144
|
+
|
145
|
+
def +(value)
|
146
|
+
@args << "+#{value}"
|
147
|
+
end
|
140
148
|
end
|
141
149
|
end
|
data/test/not_an_image.php
CHANGED
@@ -7,27 +7,27 @@
|
|
7
7
|
<!--
|
8
8
|
function process_form(the_form)
|
9
9
|
{
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
10
|
+
var element_names = new Object()
|
11
|
+
element_names["req_message"] = "Message"
|
12
|
+
|
13
|
+
if (document.all || document.getElementById)
|
14
|
+
{
|
15
|
+
for (i = 0; i < the_form.length; ++i)
|
16
|
+
{
|
17
|
+
var elem = the_form.elements[i]
|
18
|
+
if (elem.name && elem.name.substring(0, 4) == "req_")
|
19
|
+
{
|
20
|
+
if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='')
|
21
|
+
{
|
22
|
+
alert("\"" + element_names[elem.name] + "\" is a required field in this form.")
|
23
|
+
elem.focus()
|
24
|
+
return false
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
return true
|
31
31
|
}
|
32
32
|
// -->
|
33
33
|
</script>
|
@@ -35,25 +35,25 @@ function process_form(the_form)
|
|
35
35
|
|
36
36
|
body
|
37
37
|
{
|
38
|
-
|
39
|
-
|
38
|
+
margin: 0px;
|
39
|
+
padding: 0px;
|
40
40
|
}
|
41
41
|
|
42
42
|
#header
|
43
43
|
{
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
margin: 0;
|
45
|
+
padding: 0;
|
46
|
+
height: 100px;
|
47
|
+
text-align: left;
|
48
|
+
background-color: #003;
|
49
49
|
}
|
50
50
|
|
51
51
|
#navlinks
|
52
52
|
{
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
font: 10px Verdana, Arial, Helvetica, sans-serif;
|
54
|
+
color: #333333;
|
55
|
+
padding: 10px;
|
56
|
+
|
57
57
|
}
|
58
58
|
</style></head>
|
59
59
|
|
@@ -64,192 +64,192 @@ body
|
|
64
64
|
<div id="punviewtopic" class="pun">
|
65
65
|
|
66
66
|
<div id="brdheader" class="block">
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
67
|
+
<div class="box">
|
68
|
+
<div id="brdmenui" class="inbox">
|
69
|
+
<ul>
|
70
|
+
<li id="navindex"><a href="http://forum.textdrive.com/index.php">Index</a></li>
|
71
|
+
<li id="navuserlist"><a href="http://forum.textdrive.com/userlist.php">User list</a></li>
|
72
|
+
<li id="navsearch"><a href="http://forum.textdrive.com/search.php">Search</a></li>
|
73
|
+
<li id="navprofile"><a href="http://forum.textdrive.com/profile.php?id=1067">Profile</a></li>
|
74
|
+
<li id="navlogout"><a href="http://forum.textdrive.com/login.php?action=out&id=1067">Logout</a></li>
|
75
|
+
</ul>
|
76
|
+
</div>
|
77
|
+
<div id="brdwelcome" class="inbox">
|
78
|
+
<ul class="conl">
|
79
|
+
<li>Logged in as <strong>geography</strong></li>
|
80
|
+
<li>Last visit: Today 21:29:23</li>
|
81
|
+
</ul>
|
82
|
+
<div class="clearer"></div>
|
83
|
+
</div>
|
84
|
+
</div>
|
85
85
|
</div>
|
86
86
|
|
87
87
|
|
88
88
|
|
89
89
|
<div class="linkst">
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
90
|
+
<div class="inbox">
|
91
|
+
<p class="pagelink conl">Pages: <strong>1</strong></p>
|
92
|
+
<p class="postlink conr"><a href="http://forum.textdrive.com/post.php?tid=7356">Post reply</a></p>
|
93
|
+
<ul><li><a href="http://forum.textdrive.com/index.php">Index</a></li><li> » <a href="http://forum.textdrive.com/viewforum.php?id=4">Troubleshooting</a></li><li> » Lighttpd says Insufficient memory (case 4)</li></ul>
|
94
|
+
<div class="clearer"></div>
|
95
|
+
</div>
|
96
96
|
</div>
|
97
97
|
|
98
98
|
<div id="p62698" class="blockpost rowodd firstpost">
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
99
|
+
<h2><span><span class="conr">#1 </span><a href="http://forum.textdrive.com/viewtopic.php?pid=62698#p62698">Yesterday 20:47:30</a></span></h2>
|
100
|
+
<div class="box">
|
101
|
+
<div class="inbox">
|
102
|
+
<div class="postleft">
|
103
|
+
<dl>
|
104
|
+
<dt><strong><a href="http://forum.textdrive.com/profile.php?id=1067">geography</a></strong></dt>
|
105
|
+
<dd class="usertitle"><strong>Member</strong></dd>
|
106
|
+
<dd class="postavatar"></dd>
|
107
|
+
<dd>From: NYC</dd>
|
108
|
+
<dd>Registered: 2005-03-17</dd>
|
109
|
+
<dd>Posts: 10</dd>
|
110
|
+
<dd class="usercontacts"><a href="http://forum.textdrive.com/misc.php?email=1067">E-mail</a> <a href="http://journal.gleepglop.com/">Website</a></dd>
|
111
|
+
</dl>
|
112
|
+
</div>
|
113
|
+
<div class="postright">
|
114
|
+
<h3>Lighttpd says Insufficient memory (case 4)</h3>
|
115
|
+
<div class="postmsg">
|
116
|
+
<p>I
|
117
117
|
have a rails app that downloads images found on the web. I'm running it
|
118
118
|
through lighttpd and everything works fine unless it is a large image
|
119
119
|
(Like over 500k).</p>
|
120
120
|
|
121
|
-
|
121
|
+
<p>Then lighttpd throughs this error:</p>
|
122
122
|
Insufficient memory (case 4)
|
123
123
|
|
124
|
-
|
124
|
+
<p>Has anyone else encountered this? What exactly could be the root of this error?</p>
|
125
125
|
|
126
126
|
|
127
127
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
<div class="clearer"></div>
|
131
|
+
<div class="postfootleft"><p><strong>Online</strong></p></div>
|
132
|
+
<div class="postfootright"><ul><li class="postreport"><a href="http://forum.textdrive.com/misc.php?report=62698">Report</a> | </li><li class="postedit"><a href="http://forum.textdrive.com/edit.php?id=62698">Edit</a> | </li><li class="postquote"><a href="http://forum.textdrive.com/post.php?tid=7356&qid=62698">Quote</a></li></ul></div>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
135
|
</div>
|
136
136
|
|
137
137
|
<div id="p62708" class="blockpost roweven">
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
138
|
+
<h2><span><span class="conr">#2 </span><a href="http://forum.textdrive.com/viewtopic.php?pid=62708#p62708">Yesterday 22:06:50</a></span></h2>
|
139
|
+
<div class="box">
|
140
|
+
<div class="inbox">
|
141
|
+
<div class="postleft">
|
142
|
+
<dl>
|
143
|
+
<dt><strong><a href="http://forum.textdrive.com/profile.php?id=2707">jqshenker</a></strong></dt>
|
144
|
+
<dd class="usertitle"><strong>Member</strong></dd>
|
145
|
+
<dd class="postavatar"><img src="not_an_image_files/2707.jfif" alt="" height="60" width="60"></dd>
|
146
|
+
<dd>From: Palo Alto, CA</dd>
|
147
|
+
<dd>Registered: 2005-09-06</dd>
|
148
|
+
<dd>Posts: 422</dd>
|
149
|
+
<dd class="usercontacts"><a href="http://forum.textdrive.com/misc.php?email=2707">E-mail</a> <a href="http://nothingmuch.textdriven.com/">Website</a></dd>
|
150
|
+
</dl>
|
151
|
+
</div>
|
152
|
+
<div class="postright">
|
153
|
+
<h3> Re: Lighttpd says Insufficient memory (case 4)</h3>
|
154
|
+
<div class="postmsg">
|
155
|
+
<p>Yeah,
|
156
156
|
it's the limits. Are you downloading it, or resizing it as well?
|
157
157
|
Downloading usually isn't the problem, it's the resizing that breaks.</p>
|
158
158
|
|
159
159
|
|
160
160
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
161
|
+
</div>
|
162
|
+
<div class="postsignature"><hr><a href="http://soggyslides.textdriven.com/">soggyslides - {abstractisms daily}</a></div>
|
163
|
+
</div>
|
164
|
+
<div class="clearer"></div>
|
165
|
+
<div class="postfootleft"><p>Offline</p></div>
|
166
|
+
<div class="postfootright"><ul><li class="postreport"><a href="http://forum.textdrive.com/misc.php?report=62708">Report</a> | </li><li class="postquote"><a href="http://forum.textdrive.com/post.php?tid=7356&qid=62708">Quote</a></li></ul></div>
|
167
|
+
</div>
|
168
|
+
</div>
|
169
169
|
</div>
|
170
170
|
|
171
171
|
<div id="p62709" class="blockpost rowodd">
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
172
|
+
<h2><span><span class="conr">#3 </span><a href="http://forum.textdrive.com/viewtopic.php?pid=62709#p62709">Yesterday 22:12:28</a></span></h2>
|
173
|
+
<div class="box">
|
174
|
+
<div class="inbox">
|
175
|
+
<div class="postleft">
|
176
|
+
<dl>
|
177
|
+
<dt><strong><a href="http://forum.textdrive.com/profile.php?id=1045">julik</a></strong></dt>
|
178
|
+
<dd class="usertitle"><strong>Member</strong></dd>
|
179
|
+
<dd class="postavatar"><img src="not_an_image_files/1045.png" alt="" height="60" width="57"></dd>
|
180
|
+
<dd>From: Utrecht, Netherlands</dd>
|
181
|
+
<dd>Registered: 2005-03-12</dd>
|
182
|
+
<dd>Posts: 137</dd>
|
183
|
+
<dd class="usercontacts"><a href="http://forum.textdrive.com/misc.php?email=1045">E-mail</a> <a href="http://live.julik.nl/">Website</a></dd>
|
184
|
+
</dl>
|
185
|
+
</div>
|
186
|
+
<div class="postright">
|
187
|
+
<h3> Re: Lighttpd says Insufficient memory (case 4)</h3>
|
188
|
+
<div class="postmsg">
|
189
|
+
<p>that doesn't feel well</p>
|
190
190
|
|
191
191
|
|
192
192
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
<div class="clearer"></div>
|
196
|
+
<div class="postfootleft"><p><strong>Online</strong></p></div>
|
197
|
+
<div class="postfootright"><ul><li class="postreport"><a href="http://forum.textdrive.com/misc.php?report=62709">Report</a> | </li><li class="postquote"><a href="http://forum.textdrive.com/post.php?tid=7356&qid=62709">Quote</a></li></ul></div>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
200
|
</div>
|
201
201
|
|
202
202
|
<div id="p62732" class="blockpost roweven">
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
203
|
+
<h2><span><span class="conr">#4 </span><a href="http://forum.textdrive.com/viewtopic.php?pid=62732#p62732">Today 03:46:42</a></span></h2>
|
204
|
+
<div class="box">
|
205
|
+
<div class="inbox">
|
206
|
+
<div class="postleft">
|
207
|
+
<dl>
|
208
|
+
<dt><strong><a href="http://forum.textdrive.com/profile.php?id=1067">geography</a></strong></dt>
|
209
|
+
<dd class="usertitle"><strong>Member</strong></dd>
|
210
|
+
<dd class="postavatar"></dd>
|
211
|
+
<dd>From: NYC</dd>
|
212
|
+
<dd>Registered: 2005-03-17</dd>
|
213
|
+
<dd>Posts: 10</dd>
|
214
|
+
<dd class="usercontacts"><a href="http://forum.textdrive.com/misc.php?email=1067">E-mail</a> <a href="http://journal.gleepglop.com/">Website</a></dd>
|
215
|
+
</dl>
|
216
|
+
</div>
|
217
|
+
<div class="postright">
|
218
|
+
<h3> Re: Lighttpd says Insufficient memory (case 4)</h3>
|
219
|
+
<div class="postmsg">
|
220
|
+
<p>I'm resizing it too. But that is not where it dies.<br>
|
221
221
|
It dies right before I write it to disk (With Magick::Image.write from RMagick)</p>
|
222
222
|
|
223
223
|
|
224
224
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
225
|
+
</div>
|
226
|
+
</div>
|
227
|
+
<div class="clearer"></div>
|
228
|
+
<div class="postfootleft"><p><strong>Online</strong></p></div>
|
229
|
+
<div class="postfootright"><ul><li class="postreport"><a href="http://forum.textdrive.com/misc.php?report=62732">Report</a> | </li><li class="postdelete"><a href="http://forum.textdrive.com/delete.php?id=62732">Delete</a> | </li><li class="postedit"><a href="http://forum.textdrive.com/edit.php?id=62732">Edit</a> | </li><li class="postquote"><a href="http://forum.textdrive.com/post.php?tid=7356&qid=62732">Quote</a></li></ul></div>
|
230
|
+
</div>
|
231
|
+
</div>
|
232
232
|
</div>
|
233
233
|
|
234
234
|
<div id="p62735" class="blockpost rowodd">
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
235
|
+
<h2><span><span class="conr">#5 </span><a href="http://forum.textdrive.com/viewtopic.php?pid=62735#p62735">Today 04:14:08</a></span></h2>
|
236
|
+
<div class="box">
|
237
|
+
<div class="inbox">
|
238
|
+
<div class="postleft">
|
239
|
+
<dl>
|
240
|
+
<dt><strong><a href="http://forum.textdrive.com/profile.php?id=2707">jqshenker</a></strong></dt>
|
241
|
+
<dd class="usertitle"><strong>Member</strong></dd>
|
242
|
+
<dd class="postavatar"><img src="not_an_image_files/2707.jfif" alt="" height="60" width="60"></dd>
|
243
|
+
<dd>From: Palo Alto, CA</dd>
|
244
|
+
<dd>Registered: 2005-09-06</dd>
|
245
|
+
<dd>Posts: 422</dd>
|
246
|
+
<dd class="usercontacts"><a href="http://forum.textdrive.com/misc.php?email=2707">E-mail</a> <a href="http://nothingmuch.textdriven.com/">Website</a></dd>
|
247
|
+
</dl>
|
248
|
+
</div>
|
249
|
+
<div class="postright">
|
250
|
+
<h3> Re: Lighttpd says Insufficient memory (case 4)</h3>
|
251
|
+
<div class="postmsg">
|
252
|
+
<p></p><blockquote><div class="incqbox"><h4>geography wrote:</h4><p>I'm resizing it too. But that is not where it dies.<br>
|
253
253
|
It dies right before I write it to disk (With Magick::Image.write from RMagick)</p></div></blockquote><p><br>
|
254
254
|
I meant "resizing" as anything to do with RMagick. There've been a
|
255
255
|
couple threads on this, search around. Resizing you image before upload
|
@@ -258,65 +258,65 @@ might or might not work.... basically you can't do much, unfortunately.</p>
|
|
258
258
|
|
259
259
|
|
260
260
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
261
|
+
</div>
|
262
|
+
<div class="postsignature"><hr><a href="http://soggyslides.textdriven.com/">soggyslides - {abstractisms daily}</a></div>
|
263
|
+
</div>
|
264
|
+
<div class="clearer"></div>
|
265
|
+
<div class="postfootleft"><p>Offline</p></div>
|
266
|
+
<div class="postfootright"><ul><li class="postreport"><a href="http://forum.textdrive.com/misc.php?report=62735">Report</a> | </li><li class="postquote"><a href="http://forum.textdrive.com/post.php?tid=7356&qid=62735">Quote</a></li></ul></div>
|
267
|
+
</div>
|
268
|
+
</div>
|
269
269
|
</div>
|
270
270
|
|
271
271
|
<div id="p62737" class="blockpost roweven">
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
272
|
+
<h2><span><span class="conr">#6 </span><a href="http://forum.textdrive.com/viewtopic.php?pid=62737#p62737">Today 04:17:28</a></span></h2>
|
273
|
+
<div class="box">
|
274
|
+
<div class="inbox">
|
275
|
+
<div class="postleft">
|
276
|
+
<dl>
|
277
|
+
<dt><strong><a href="http://forum.textdrive.com/profile.php?id=1097">cch</a></strong></dt>
|
278
|
+
<dd class="usertitle"><strong>Member</strong></dd>
|
279
|
+
<dd class="postavatar"></dd>
|
280
|
+
<dd>Registered: 2005-03-21</dd>
|
281
|
+
<dd>Posts: 108</dd>
|
282
|
+
<dd class="usercontacts"><a href="http://forum.textdrive.com/misc.php?email=1097">E-mail</a></dd>
|
283
|
+
</dl>
|
284
|
+
</div>
|
285
|
+
<div class="postright">
|
286
|
+
<h3> Re: Lighttpd says Insufficient memory (case 4)</h3>
|
287
|
+
<div class="postmsg">
|
288
|
+
<p>what if you use open(fname, 'w'){|f|f.write img.to_blob} ?</p>
|
289
289
|
|
290
290
|
|
291
291
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
292
|
+
</div>
|
293
|
+
</div>
|
294
|
+
<div class="clearer"></div>
|
295
|
+
<div class="postfootleft"><p>Offline</p></div>
|
296
|
+
<div class="postfootright"><ul><li class="postreport"><a href="http://forum.textdrive.com/misc.php?report=62737">Report</a> | </li><li class="postquote"><a href="http://forum.textdrive.com/post.php?tid=7356&qid=62737">Quote</a></li></ul></div>
|
297
|
+
</div>
|
298
|
+
</div>
|
299
299
|
</div>
|
300
300
|
|
301
301
|
<div id="p62767" class="blockpost rowodd">
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
302
|
+
<h2><span><span class="conr">#7 </span><a href="http://forum.textdrive.com/viewtopic.php?pid=62767#p62767">Today 15:44:42</a></span></h2>
|
303
|
+
<div class="box">
|
304
|
+
<div class="inbox">
|
305
|
+
<div class="postleft">
|
306
|
+
<dl>
|
307
|
+
<dt><strong><a href="http://forum.textdrive.com/profile.php?id=1067">geography</a></strong></dt>
|
308
|
+
<dd class="usertitle"><strong>Member</strong></dd>
|
309
|
+
<dd class="postavatar"></dd>
|
310
|
+
<dd>From: NYC</dd>
|
311
|
+
<dd>Registered: 2005-03-17</dd>
|
312
|
+
<dd>Posts: 10</dd>
|
313
|
+
<dd class="usercontacts"><a href="http://forum.textdrive.com/misc.php?email=1067">E-mail</a> <a href="http://journal.gleepglop.com/">Website</a></dd>
|
314
|
+
</dl>
|
315
|
+
</div>
|
316
|
+
<div class="postright">
|
317
|
+
<h3> Re: Lighttpd says Insufficient memory (case 4)</h3>
|
318
|
+
<div class="postmsg">
|
319
|
+
<p>Using
|
320
320
|
open(fname, 'w'){|f|f.write img.to_blob} has the same problem... I
|
321
321
|
guess I'll try and run it from the command line but that seems like a
|
322
322
|
drastic step. Why is the memory so limited, shouldn't the server be
|
@@ -324,77 +324,77 @@ able to save 500k files, or does imageMagick have a very high overhead?</p>
|
|
324
324
|
|
325
325
|
|
326
326
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
327
|
+
</div>
|
328
|
+
</div>
|
329
|
+
<div class="clearer"></div>
|
330
|
+
<div class="postfootleft"><p><strong>Online</strong></p></div>
|
331
|
+
<div class="postfootright"><ul><li class="postreport"><a href="http://forum.textdrive.com/misc.php?report=62767">Report</a> | </li><li class="postdelete"><a href="http://forum.textdrive.com/delete.php?id=62767">Delete</a> | </li><li class="postedit"><a href="http://forum.textdrive.com/edit.php?id=62767">Edit</a> | </li><li class="postquote"><a href="http://forum.textdrive.com/post.php?tid=7356&qid=62767">Quote</a></li></ul></div>
|
332
|
+
</div>
|
333
|
+
</div>
|
334
334
|
</div>
|
335
335
|
|
336
336
|
<div id="p62774" class="blockpost roweven">
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
337
|
+
<h2><span><span class="conr">#8 </span><a href="http://forum.textdrive.com/viewtopic.php?pid=62774#p62774">Today 17:03:28</a></span></h2>
|
338
|
+
<div class="box">
|
339
|
+
<div class="inbox">
|
340
|
+
<div class="postleft">
|
341
|
+
<dl>
|
342
|
+
<dt><strong><a href="http://forum.textdrive.com/profile.php?id=2707">jqshenker</a></strong></dt>
|
343
|
+
<dd class="usertitle"><strong>Member</strong></dd>
|
344
|
+
<dd class="postavatar"><img src="not_an_image_files/2707.jfif" alt="" height="60" width="60"></dd>
|
345
|
+
<dd>From: Palo Alto, CA</dd>
|
346
|
+
<dd>Registered: 2005-09-06</dd>
|
347
|
+
<dd>Posts: 422</dd>
|
348
|
+
<dd class="usercontacts"><a href="http://forum.textdrive.com/misc.php?email=2707">E-mail</a> <a href="http://nothingmuch.textdriven.com/">Website</a></dd>
|
349
|
+
</dl>
|
350
|
+
</div>
|
351
|
+
<div class="postright">
|
352
|
+
<h3> Re: Lighttpd says Insufficient memory (case 4)</h3>
|
353
|
+
<div class="postmsg">
|
354
|
+
<p>RMagick
|
355
355
|
does leak memory in some versions (there's a patched version of
|
356
356
|
file_column which resizes via the commandline), but I'm not sure why
|
357
357
|
you can't resize larger images. It doesn't take <strong>that</strong> much memory.</p>
|
358
358
|
|
359
359
|
|
360
360
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
361
|
+
</div>
|
362
|
+
<div class="postsignature"><hr><a href="http://soggyslides.textdriven.com/">soggyslides - {abstractisms daily}</a></div>
|
363
|
+
</div>
|
364
|
+
<div class="clearer"></div>
|
365
|
+
<div class="postfootleft"><p>Offline</p></div>
|
366
|
+
<div class="postfootright"><ul><li class="postreport"><a href="http://forum.textdrive.com/misc.php?report=62774">Report</a> | </li><li class="postquote"><a href="http://forum.textdrive.com/post.php?tid=7356&qid=62774">Quote</a></li></ul></div>
|
367
|
+
</div>
|
368
|
+
</div>
|
369
369
|
</div>
|
370
370
|
|
371
371
|
<div id="p62782" class="blockpost rowodd">
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
372
|
+
<h2><span><span class="conr">#9 </span><a href="http://forum.textdrive.com/viewtopic.php?pid=62782#p62782">Today 19:04:21</a></span></h2>
|
373
|
+
<div class="box">
|
374
|
+
<div class="inbox">
|
375
|
+
<div class="postleft">
|
376
|
+
<dl>
|
377
|
+
<dt><strong><a href="http://forum.textdrive.com/profile.php?id=1067">geography</a></strong></dt>
|
378
|
+
<dd class="usertitle"><strong>Member</strong></dd>
|
379
|
+
<dd class="postavatar"></dd>
|
380
|
+
<dd>From: NYC</dd>
|
381
|
+
<dd>Registered: 2005-03-17</dd>
|
382
|
+
<dd>Posts: 10</dd>
|
383
|
+
<dd class="usercontacts"><a href="http://forum.textdrive.com/misc.php?email=1067">E-mail</a> <a href="http://journal.gleepglop.com/">Website</a></dd>
|
384
|
+
</dl>
|
385
|
+
</div>
|
386
|
+
<div class="postright">
|
387
|
+
<h3> Re: Lighttpd says Insufficient memory (case 4)</h3>
|
388
|
+
<div class="postmsg">
|
389
|
+
<p>So what i've learned so far...</p>
|
390
|
+
|
391
|
+
<p>TextDrive has a memory limit.<br>
|
392
392
|
-When using RMagick in a rails app running with fcgi and lighttpd this memory limit is exceeded.<br>
|
393
393
|
-When the memory limit is exceeded the fcgi process is killed (No expcetions caught or anything in Ruby... the process ends)<br>
|
394
394
|
-The problem occurs when writing images to disk (With either File.open or Image.write)<br>
|
395
395
|
-The problem still occurs if I call GC.starts after RMagick calls</p>
|
396
396
|
|
397
|
-
|
397
|
+
<p>Here is what I don't get...<br>
|
398
398
|
-Why is the memory limit so low (Or why does a simple RMagick call take
|
399
399
|
up so much memory? My dispatch procs take up around 50 megs, I can't
|
400
400
|
imagine that opening a 600k file would come close to using that much
|
@@ -403,199 +403,199 @@ memory)<br>
|
|
403
403
|
|
404
404
|
|
405
405
|
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
406
|
+
</div>
|
407
|
+
</div>
|
408
|
+
<div class="clearer"></div>
|
409
|
+
<div class="postfootleft"><p><strong>Online</strong></p></div>
|
410
|
+
<div class="postfootright"><ul><li class="postreport"><a href="http://forum.textdrive.com/misc.php?report=62782">Report</a> | </li><li class="postdelete"><a href="http://forum.textdrive.com/delete.php?id=62782">Delete</a> | </li><li class="postedit"><a href="http://forum.textdrive.com/edit.php?id=62782">Edit</a> | </li><li class="postquote"><a href="http://forum.textdrive.com/post.php?tid=7356&qid=62782">Quote</a></li></ul></div>
|
411
|
+
</div>
|
412
|
+
</div>
|
413
413
|
</div>
|
414
414
|
|
415
415
|
<div id="p62785" class="blockpost roweven">
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
416
|
+
<h2><span><span class="conr">#10 </span><a href="http://forum.textdrive.com/viewtopic.php?pid=62785#p62785">Today 19:29:11</a></span></h2>
|
417
|
+
<div class="box">
|
418
|
+
<div class="inbox">
|
419
|
+
<div class="postleft">
|
420
|
+
<dl>
|
421
|
+
<dt><strong><a href="http://forum.textdrive.com/profile.php?id=1097">cch</a></strong></dt>
|
422
|
+
<dd class="usertitle"><strong>Member</strong></dd>
|
423
|
+
<dd class="postavatar"></dd>
|
424
|
+
<dd>Registered: 2005-03-21</dd>
|
425
|
+
<dd>Posts: 108</dd>
|
426
|
+
<dd class="usercontacts"><a href="http://forum.textdrive.com/misc.php?email=1097">E-mail</a></dd>
|
427
|
+
</dl>
|
428
|
+
</div>
|
429
|
+
<div class="postright">
|
430
|
+
<h3> Re: Lighttpd says Insufficient memory (case 4)</h3>
|
431
|
+
<div class="postmsg">
|
432
|
+
<p>the memory limit is 100mb.</p>
|
433
|
+
|
434
|
+
<p>watch
|
435
435
|
your process as you make the upload to see how high it goes. also try
|
436
436
|
resizing an image using a standalone (no rails) ruby script and see how
|
437
437
|
much memory it uses this way.</p>
|
438
438
|
|
439
439
|
|
440
440
|
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
441
|
+
</div>
|
442
|
+
</div>
|
443
|
+
<div class="clearer"></div>
|
444
|
+
<div class="postfootleft"><p>Offline</p></div>
|
445
|
+
<div class="postfootright"><ul><li class="postreport"><a href="http://forum.textdrive.com/misc.php?report=62785">Report</a> | </li><li class="postquote"><a href="http://forum.textdrive.com/post.php?tid=7356&qid=62785">Quote</a></li></ul></div>
|
446
|
+
</div>
|
447
|
+
</div>
|
448
448
|
</div>
|
449
449
|
|
450
450
|
<div id="p62796" class="blockpost rowodd">
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
451
|
+
<h2><span><span class="conr">#11 </span><a href="http://forum.textdrive.com/viewtopic.php?pid=62796#p62796">Today 21:13:19</a></span></h2>
|
452
|
+
<div class="box">
|
453
|
+
<div class="inbox">
|
454
|
+
<div class="postleft">
|
455
|
+
<dl>
|
456
|
+
<dt><strong><a href="http://forum.textdrive.com/profile.php?id=1067">geography</a></strong></dt>
|
457
|
+
<dd class="usertitle"><strong>Member</strong></dd>
|
458
|
+
<dd class="postavatar"></dd>
|
459
|
+
<dd>From: NYC</dd>
|
460
|
+
<dd>Registered: 2005-03-17</dd>
|
461
|
+
<dd>Posts: 10</dd>
|
462
|
+
<dd class="usercontacts"><a href="http://forum.textdrive.com/misc.php?email=1067">E-mail</a> <a href="http://journal.gleepglop.com/">Website</a></dd>
|
463
|
+
</dl>
|
464
|
+
</div>
|
465
|
+
<div class="postright">
|
466
|
+
<h3> Re: Lighttpd says Insufficient memory (case 4)</h3>
|
467
|
+
<div class="postmsg">
|
468
|
+
<p>So after some investigation it seems like RMagick is a total memory hog.</p>
|
469
|
+
|
470
|
+
<p>I load a 750k image with this tiny standalone ruby program...</p>
|
471
|
+
|
472
|
+
<p>image = nil<br>
|
473
473
|
open(filepath) do |f|</p>
|
474
474
|
image = Magick::Image.from_blob(f.read).first<br>
|
475
475
|
end<br>
|
476
476
|
image.write("image.jpg")
|
477
477
|
|
478
|
-
|
479
|
-
|
478
|
+
<p>Monitoring the mem usage (using top) I get this 8th column is mem usuage</p>
|
479
|
+
<p>#File being downloaded<br>
|
480
480
|
7198 ruby 7.6% 0:04.83 2 15 60 3.37M+ 2.65M 4.88M+ 44.5M+<br>
|
481
481
|
7198 ruby 14.4% 0:05.01 2 15 68 18.1M+ 2.73M+ 20.0M+ 80.9M+<br>
|
482
482
|
7198 ruby 35.0% 0:05.49 2 15 67 41.8M+ 2.73M 43.7M+ 80.8M-</p>
|
483
|
-
|
483
|
+
<p>#File being loading into Magick::Image<br>
|
484
484
|
7198 ruby 0.1% 0:05.49 2 15 67 41.8M 2.73M 43.7M 80.8M-<br>
|
485
485
|
7198 ruby 0.1% 0:05.49 2 15 67 41.8M 2.73M 43.7M 80.8M-</p>
|
486
|
-
|
486
|
+
<p>#File being written to disk<br>
|
487
487
|
7198 ruby 3.4% 0:05.53 2 15 72 43.4M+ 2.73M 45.3M+ 122M+<br>
|
488
488
|
7198 ruby 55.9% 0:06.29 2 15 72 61.1M+ 2.73M 63.0M+ 122M <br>
|
489
489
|
7198 ruby 48.4% 0:06.93 2 15 72 76.1M+ 2.73M 78.1M+ 122M <br>
|
490
490
|
7198 ruby 48.2% 0:07.55 2 15 67 42.5M- 2.73M 44.4M- 80.8M-</p>
|
491
491
|
|
492
|
-
|
492
|
+
<p>So
|
493
493
|
I guess the moral is RMagick eats up a ton of memory. I can't really
|
494
494
|
see anyway around this problem though, maybe using the command line
|
495
495
|
would eat up less memory (which is what I'll try next)</p>
|
496
496
|
|
497
497
|
|
498
498
|
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
499
|
+
<p class="postedit"><em>Last edited by geography (Today 21:29:17)</em></p>
|
500
|
+
</div>
|
501
|
+
</div>
|
502
|
+
<div class="clearer"></div>
|
503
|
+
<div class="postfootleft"><p><strong>Online</strong></p></div>
|
504
|
+
<div class="postfootright"><ul><li class="postreport"><a href="http://forum.textdrive.com/misc.php?report=62796">Report</a> | </li><li class="postdelete"><a href="http://forum.textdrive.com/delete.php?id=62796">Delete</a> | </li><li class="postedit"><a href="http://forum.textdrive.com/edit.php?id=62796">Edit</a> | </li><li class="postquote"><a href="http://forum.textdrive.com/post.php?tid=7356&qid=62796">Quote</a></li></ul></div>
|
505
|
+
</div>
|
506
|
+
</div>
|
507
507
|
</div>
|
508
508
|
|
509
509
|
<div id="p62801" class="blockpost roweven">
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
510
|
+
<h2><span><span class="conr">#12 </span><a href="http://forum.textdrive.com/viewtopic.php?pid=62801#p62801">Today 21:55:36</a></span></h2>
|
511
|
+
<div class="box">
|
512
|
+
<div class="inbox">
|
513
|
+
<div class="postleft">
|
514
|
+
<dl>
|
515
|
+
<dt><strong><a href="http://forum.textdrive.com/profile.php?id=1097">cch</a></strong></dt>
|
516
|
+
<dd class="usertitle"><strong>Member</strong></dd>
|
517
|
+
<dd class="postavatar"></dd>
|
518
|
+
<dd>Registered: 2005-03-21</dd>
|
519
|
+
<dd>Posts: 108</dd>
|
520
|
+
<dd class="usercontacts"><a href="http://forum.textdrive.com/misc.php?email=1097">E-mail</a></dd>
|
521
|
+
</dl>
|
522
|
+
</div>
|
523
|
+
<div class="postright">
|
524
|
+
<h3> Re: Lighttpd says Insufficient memory (case 4)</h3>
|
525
|
+
<div class="postmsg">
|
526
|
+
<p>Yea, now you have to know whether it's RMagick specifically, or ImageMagick itself that is a memory hog.</p>
|
527
|
+
|
528
|
+
<p>I
|
529
529
|
suppose it goes memory hungry because it expands a full uncompressed
|
530
530
|
24bit bitmap to memory, and that's innevitably large. (entirely
|
531
531
|
uninformed hunch)</p>
|
532
532
|
|
533
|
-
|
533
|
+
<p>There's ruby-GD as an alternative, but it
|
534
534
|
doesn't look nearly as nice, and I've never used it, and I don't know
|
535
535
|
if it'd be more or less of a hog.</p>
|
536
536
|
|
537
537
|
|
538
538
|
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
539
|
+
<p class="postedit"><em>Last edited by cch (Today 21:56:17)</em></p>
|
540
|
+
</div>
|
541
|
+
</div>
|
542
|
+
<div class="clearer"></div>
|
543
|
+
<div class="postfootleft"><p>Offline</p></div>
|
544
|
+
<div class="postfootright"><ul><li class="postreport"><a href="http://forum.textdrive.com/misc.php?report=62801">Report</a> | </li><li class="postquote"><a href="http://forum.textdrive.com/post.php?tid=7356&qid=62801">Quote</a></li></ul></div>
|
545
|
+
</div>
|
546
|
+
</div>
|
547
547
|
</div>
|
548
548
|
|
549
549
|
<div class="postlinksb">
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
550
|
+
<div class="inbox">
|
551
|
+
<p class="postlink conr"><a href="http://forum.textdrive.com/post.php?tid=7356">Post reply</a></p>
|
552
|
+
<p class="pagelink conl">Pages: <strong>1</strong></p>
|
553
|
+
<ul><li><a href="http://forum.textdrive.com/index.php">Index</a></li><li> » <a href="http://forum.textdrive.com/viewforum.php?id=4">Troubleshooting</a></li><li> » Lighttpd says Insufficient memory (case 4)</li></ul>
|
554
|
+
<p class="subscribelink clearb">You are currently subscribed to this topic - <a href="http://forum.textdrive.com/misc.php?unsubscribe=7356">Unsubscribe</a></p>
|
555
|
+
</div>
|
556
556
|
</div>
|
557
557
|
|
558
558
|
<div class="blockform">
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
559
|
+
<h2><span>Quick post</span></h2>
|
560
|
+
<div class="box">
|
561
|
+
<form method="post" action="post.php?tid=7356" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">
|
562
|
+
<div class="inform">
|
563
|
+
<fieldset>
|
564
|
+
<legend>Write your message and submit <span style="color: red; text-decoration: underline;">keeping in mind that this is not an official support forum.</span></legend>
|
565
|
+
<div class="infldset txtarea">
|
566
|
+
<input name="form_sent" value="1" type="hidden">
|
567
|
+
<input name="form_user" value="geography" type="hidden">
|
568
|
+
<label><textarea name="req_message" rows="7" cols="75" tabindex="1"></textarea></label>
|
569
|
+
<ul class="bblinks">
|
570
|
+
<li><a href="http://forum.textdrive.com/help.php#bbcode" onclick="window.open(this.href); return false;">BBCode</a>: on</li>
|
571
|
+
<li><a href="http://forum.textdrive.com/help.php#img" onclick="window.open(this.href); return false;">[img] tag</a>: on</li>
|
572
|
+
<li><a href="http://forum.textdrive.com/help.php#smilies" onclick="window.open(this.href); return false;">Smilies</a>: off</li>
|
573
|
+
</ul>
|
574
|
+
</div>
|
575
|
+
</fieldset>
|
576
|
+
</div>
|
577
|
+
<p><input name="submit" tabindex="2" value="Submit" accesskey="s" type="submit"></p>
|
578
|
+
</form>
|
579
|
+
</div>
|
580
580
|
</div>
|
581
581
|
|
582
582
|
<div id="brdfooter" class="block">
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
583
|
+
<h2><span>Board footer</span></h2>
|
584
|
+
<div class="box">
|
585
|
+
<div class="inbox">
|
586
|
+
|
587
|
+
<div class="conl">
|
588
|
+
<form id="qjump" method="get" action="viewforum.php">
|
589
|
+
<div><label>Jump to
|
590
|
+
<br><select name="id" onchange="window.location=('viewforum.php?id='+this.options[this.selectedIndex].value)"><optgroup label="TextDrive Hosting"><option value="2">Announcements</option><option value="33">Questions and Stuff</option><option value="11">Why Host With TXD?</option><option value="1">Getting Started</option><option value="3">How Do I...?</option><option value="4" selected="selected">Troubleshooting</option><option value="15">SPAM and Security</option><option value="5">Coding in General</option><option value="16">Localhostin'</option><option value="31">Look What I Did Dammit</option><option value="6">TextDrivel</option><option value="8">Archives</option><option value="32">Designing yourself into a corner</option></optgroup><optgroup label="TextDrive Internationale"><option value="23">TextDrive En Español</option><option value="24">TextDrive en Français</option></optgroup><optgroup label="Applications (and their developers) on TextDrive"><option value="7">Textpattern</option><option value="9">RubyOnRails</option><option value="10">Instiki</option><option value="12">Photostack</option><option value="13">PunBB</option><option value="14">WordPress</option><option value="17">Epilog</option><option value="20">sIFR</option><option value="22">Subversion</option><option value="26">Lightpress</option><option value="27">Loudblog</option><option value="25">Strongspace</option><option value="29">RailsAppHosting</option><option value="35">Anemone</option><option value="28">Django</option><option value="30">TurboGears</option><option value="34">Templation</option></optgroup></select>
|
591
|
+
<input value=" Go " accesskey="g" type="submit">
|
592
|
+
</label></div>
|
593
|
+
</form>
|
594
|
+
</div>
|
595
|
+
<p class="conr">Powered by <a href="http://www.punbb.org/">PunBB</a><br>© Copyright 2002–2005 Rickard Andersson</p>
|
596
|
+
<div class="clearer"></div>
|
597
|
+
</div>
|
598
|
+
</div>
|
599
599
|
</div>
|
600
600
|
|
601
601
|
</div>
|