ImageVoodoo Gem 0.3 Problem

Has anyone else experienced this problem?

ImageVoodoo.with_image(xxxx.jpg) do |img|
img.cropped_thumbnail(100) { |img2| img2.save “CTH.jpg” }
img.with_crop(100, 200, 400, 600) { |img2| img2.save “CR.jpg” }
img.thumbnail(50) { |img2| img2.save “TH.jpg” }
img.resize(100, 150) do |img2|
img2.save “HEH.jpg”
img2.save “HEH.png”
end
end

fails to produce the thumbnail files CTH.jpg and TH.jpg in both Ububtu
8.04 and Vista Business using recent nightly builds of Netbeans/JRuby.

I am not sure how the return (block_given etc.) from the scale method is
handled in the thumbnail method.
The code seems incomplete. What am I missing here?

def scale(ratio)
new_width, new_height = (width * ratio).to_i, (height * ratio).to_i
resize(new_width, new_height) do |image|
target = ImageVoodoo.new image
block_given? ? yield(target) : target
end
end

def thumbnail(size)
scale(size.to_f / (width > height ? width : height))
end

Thanks

Paul F.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Paul F. wrote:

end
resize(new_width, new_height) do |image|
target = ImageVoodoo.new image
block_given? ? yield(target) : target end
end

def thumbnail(size)
scale(size.to_f / (width > height ? width : height))
end
I think we need to add a yield in thumbnail method

def thumbnail(size)
_yield _scale(size.to_f / (width > height ? width : height))
end

this creates the file but the file is empty and the program bombs out
with "undefined method ‘getColorModel’ "

Paul F.

I believe I just fixed the issue on trunk…Can you try it out and
double check that it is fixed?

-Tom

On Fri, Jul 18, 2008 at 8:33 AM, Paul F. [email protected] wrote:

end
resize(new_width, new_height) do |image|
Paul F.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: [email protected] , [email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

http://jruby-extras.rubyforge.org/svn/trunk/image_voodoo

-Tom

On Fri, Jul 18, 2008 at 11:09 PM, Paul F. [email protected]
wrote:

double check that it is fixed?


Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: [email protected] , [email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Thomas E Enebo wrote:

Hi Thomas,

Still missing the thumbnail file TH.jpg
CTH.jpg now OK.

Paul F.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Thomas,

url for trunk please

Thanks
Paul F.

Thomas E Enebo wrote:

I believe I just fixed the issue on trunk…Can you try it out and
double check that it is fixed?

-Tom


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Thomas E Enebo wrote:

http://jruby-extras.rubyforge.org/svn/trunk/image_voodoo

-Tom
Hi Thomas,

This works :slight_smile:

def thumbnail(size)
target = scale(size.to_f / (width > height ? width : height))
block_given? ? yield(target) : target
end

Paul F.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Thanks…I just committed that change.

-Tom

On Fri, Jul 18, 2008 at 11:56 PM, Paul F. [email protected]
wrote:

def thumbnail(size)


Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: [email protected] , [email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs