Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Lightbox2在rails应用程序的每一页上都会显示损坏的图像_Ruby On Rails_Asset Pipeline_Lightbox2 - Fatal编程技术网

Ruby on rails Lightbox2在rails应用程序的每一页上都会显示损坏的图像

Ruby on rails Lightbox2在rails应用程序的每一页上都会显示损坏的图像,ruby-on-rails,asset-pipeline,lightbox2,Ruby On Rails,Asset Pipeline,Lightbox2,我整个星期都有这个问题,我试过的所有方法都没有奏效,我甚至不知道为什么会有这个问题。(这有点像是一个后续行动 我将Lightbox2JS和css文件添加到我的rails 3.2.8项目中 目前,我在本地环境中的每个页面(甚至在标记中我没有调用lightbox的页面)的控制台中都会出现这些错误- Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/a

我整个星期都有这个问题,我试过的所有方法都没有奏效,我甚至不知道为什么会有这个问题。(这有点像是一个后续行动

我将Lightbox2JS和css文件添加到我的rails 3.2.8项目中

目前,我在本地环境中的每个页面(甚至在标记中我没有调用lightbox的页面)的控制台中都会出现这些错误-

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/assets/images/close.png

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/assets/images/laoding.gif
每页上都会显示破损的图像指示器

我将路径更改硬编码到lightbox.js,以适当地检索前面提到的图像,它们在使用lightbox时会正常工作

  LightboxOptions = (function() {

    function LightboxOptions() {
      + this.fileLoadingImage = '/assets/loading.gif';
      + this.fileCloseImage = '/assets/close.png';
      - this.fileLoadingImage = 'images/loading.gif';
      - this.fileCloseImage = 'images/close.png';
      this.resizeDuration = 700;
      this.fadeDuration = 500;
      this.labelImage = "Image";
      this.labelOf = "of";
    }
当我可以清楚地看到在本地环境中工作的图像时,我不明白为什么会出现这些错误。另一件奇怪的事情是,lightbox仍然在工作,而不必在application.js和application.css中要求它

这是我学期的结果-

Started GET "/assets/images/loading.gif" for 127.0.0.1 at 2013-01-06 12:36:31 -0800
Served asset /images/loading.gif - 404 Not Found (11ms)
ActionController::RoutingError (No route matches [GET] "/assets/images/loading.gif"):
close也是一样(但从截图上看,它显然出现了)

application.js

//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require jquery.ui.datepicker
//= require justgage
//= require raphael.min
//= require jquery.purr
//= require best_in_place
//= require_tree .
(我不需要上面的灯箱吗?)

(我不需要上面的灯箱吗?)

视图中正在使用的灯箱

 <div class="row does_description_whole">
    <div class="row offset3">
      <div class="span3 does_description_text">
        <h4>Joe Popular</h4>
        <p>Lorem ipsum hipster bacon.</p>
      </div>
      <div class="span3">
        <a href="https://lh6.googleusercontent.com/picture/joe_does.png" rel="lightbox"><img src="https://lh3.googleusercontent.com/pciture/glance_town.png" class="does_pictures"></a>
      </div>
    </div>  
  </div

乔受欢迎
Lorem ipsum hipster培根


如果要使用“资产”管道,应参考以下图像:

= (link_to image_tag(pic.image_url(:thumb)), pic.image_url, :rel => "group2", :class => "lightbox") if pic.image?
您可以考虑使用<代码> Link Kyto < /Case>帮助器,而不是<代码> HREF 。<代码>:Re= > >代码>指定要浏览的图像源。

通常,对图像的引用采用以下格式:

url('yourpng.png')
关于为什么不应该在清单中包含lightbox:应该在
.js
.css
清单中都包含它们


解决方案:最终,它就像
rm-rf public/assets
一样简单(@Tmacram与我们分享了正确的解决方案).

感谢您的关注和关注。您的解释对我来说很有意义。尽管如此,我认为问题比我想象的更严重。即使在我删除了lightbox元素(以去除损坏的图像)后,页面源仍然显示lightbox元素。这可能与我在本地编译资产有关,以解决部署到heroku的一个单独问题。我相信我公开请求这些资产?这似乎确实与预编译资产有关。您说过问题出在生产环境中?上面屏幕截图中显示的损坏的IMG来自我的本地和light box即使删除了资产管道中的所有内容,仍将加载到生产中。已排序,感谢您帮助我完成修复,它与rm-rf public/Assets一样简单。我很高兴听到它。祝您好运。
url('yourpng.png')