Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChunkyPNG::Image from_datastream method #5

Closed
didip opened this issue Sep 16, 2010 · 4 comments
Closed

ChunkyPNG::Image from_datastream method #5

didip opened this issue Sep 16, 2010 · 4 comments

Comments

@didip
Copy link

didip commented Sep 16, 2010

def self.from_datastream(ds)
  image = super(ds)
  image.metadata = ds.metadata
  return image
end

We had this bug where metadata is not defined on instance of ChunkyPNG::Canvas. Which is correct. (There is no metadata attribute on ChunkyPNG::Canvas).

Commenting out the following fixes our bug.
image.metadata = ds.metadata

Should ChunkyPNG::Canvas instance have metadata attribute?

@wvanbergen
Copy link
Owner

The idea is that the Canvas class only handles pixel data. The image class handles other aspects that can be part of a PNG image (currently only metadata). SO it is correct that the Canvas class does not have the metadata member.

The question remains how you got this error. Do you have a code snippet that reproduces this issue?

@didip
Copy link
Author

didip commented Sep 16, 2010

We have just a plain ol' .scss file. See the following:

#buy_and_activity_feed { float: left;
  #like_event { height: 108px; }
  #activity { width: 206px; height: 317px; background: sprite-image("home/activity_feed.png") no-repeat; }
}

We of course use ChunkyPNG via Lemonade. The sprite css fails to generate because of this error.

@didip
Copy link
Author

didip commented Sep 16, 2010

If it helps, I've attached the following stacktrace:

NoMethodError on line 40 of /Users/didip/.rvm/gems/ree-1.8.7-2010.02/gems/chunky_png-0.9.0/lib/chunky_png/image.rb: undefined method `metadata=' for #<ChunkyPNG::Canvas:0x101129600>
  /Users/didip/.rvm/gems/ree-1.8.7-2010.02/gems/chunky_png-0.9.0/lib/chunky_png/canvas/png_decoding.rb:50:in `from_file'
  /Users/didip/.rvm/gems/ree-1.8.7-2010.02/gems/lemonade-0.3.4/lib/lemonade/lemonade.rb:9:in `generate_sprites'
  /Users/didip/.rvm/gems/ree-1.8.7-2010.02/gems/lemonade-0.3.4/lib/lemonade/lemonade.rb:7:in `each'
  /Users/didip/.rvm/gems/ree-1.8.7-2010.02/gems/lemonade-0.3.4/lib/lemonade/lemonade.rb:7:in `generate_sprites'
  /Users/didip/.rvm/gems/ree-1.8.7-2010.02/gems/lemonade-0.3.4/lib/lemonade/lemonade.rb:4:in `each'
  /Users/didip/.rvm/gems/ree-1.8.7-2010.02/gems/lemonade-0.3.4/lib/lemonade/lemonade.rb:4:in `generate_sprites'
  /Users/didip/.rvm/gems/ree-1.8.7-2010.02/gems/lemonade-0.3.4/lib/lemonade.rb:59:in `render'

@wvanbergen
Copy link
Owner

Fixed by yourself. Thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants