2012-08-16 144 views
1

当通过git将图像上传到heroku时,图像从Web服务器发送时会损坏。我一直试图通过再次登录g rm --cached images/contact-me.png然后g add images/contact-me.png来解决问题,然后再推送。Heroku图像损坏

另外;

[email protected]:~/labs/exposeit-site$ sha1sum images/contact-me.png 
2d319cd64e94afe7cdd169347653670a1dd82581 images/contact-me.png 
[email protected]:~/labs/exposeit-site$ wget http://exposeit.herokuapp.com/images/contact-me.png 
--2012-08-16 16:50:35-- http://exposeit.herokuapp.com/images/contact-me.png 
Resolving exposeit.herokuapp.com (exposeit.herokuapp.com)... 50.19.121.246, 174.129.192.155, 184.73.155.93, ... 
Connecting to exposeit.herokuapp.com (exposeit.herokuapp.com)|50.19.121.246|:80... connected. 
HTTP request sent, awaiting response... 200 OK 
Length: 1230115 (1.2M) [image/png] 
Saving to: `contact-me.png' 

100%[=================================================================================>] 1,230,115 963K/s in 1.2s  

2012-08-16 16:50:36 (963 KB/s) - `contact-me.png' saved [1230115/1230115] 

[email protected]:~/labs/exposeit-site$ sha1sum contact-me.png 
74d97745d35bb67e5517611b683ed461bd0c1686 contact-me.png 

[email protected]:~/labs/exposeit-site$ g ls-files | grep contact-me 
images/contact-me.png 

这是Heroku的一个问题?

更新

Procfile:

web: bundle exec thin start -R config.ru -e $RACK_ENV -p $PORT 

回答

2

所以答案是,thin宝石有需要,而不是字节数组的长度是字符串长度的错误底层图片。为什么它会首先被转换成一个字符串,我不知道。

的解决方案是增加,到你的Gemfile:

gem 'rack-jekyll', :git => 'https://github.com/adaoraul/rack-jekyll.git', :require => 'rack/jekyll' 

...,它会从GitHub,而不是RubyGems的下载。

1

奇怪。尽管如此,你看起来还好吧。 http://exposeit.herokuapp.com/images/contact-me.png

是最好的托管图片和静态内容的其他地方,而不是把兆字节的源代码控制https://devcenter.heroku.com/articles/s3

+0

当我要求该文件时,鞋子已被切断。由于我们现在只是测试Heroku(意思是说,我们还没有投入),所以我们现在不在S3上托管它们。此外,这些图像不是静态的,但可以在提交之间进行更改,因为我同时执行编码和图形... – Henrik 2012-08-17 07:31:09

+0

您可以通过在服务器上运行“sha1sum”来测试映像在上载过程中是否损坏https:// devcenter .heroku.com/articles/ssh-access – 2012-08-17 12:59:14

+0

使用'heroku run bash'在bash中映像散列正确。 – Henrik 2012-08-20 15:10:22