CollectionFS,带ReactJS的显示图像

CollectionFS,带ReactJS的显示图像,reactjs,meteor,collectionfs,Reactjs,Meteor,Collectionfs,我在CollectionFS集合中显示图像时遇到问题。 控制台告诉我资源不可用,错误为503错误 我使用的是meteor版本1.6.1.1 我不知道为什么无法访问这些图像。 我看过这里的各种帖子,但都没有涉及Meteor&ReactJS 任何帮助都将不胜感激 xport default class Home extends Component { constructor(props){ super() this.profileImage = this.getProfileImag

我在CollectionFS集合中显示图像时遇到问题。 控制台告诉我资源不可用,错误为503错误

我使用的是meteor版本1.6.1.1

我不知道为什么无法访问这些图像。 我看过这里的各种帖子,但都没有涉及Meteor&ReactJS

任何帮助都将不胜感激

xport default class Home extends Component {
constructor(props){
    super()
    this.profileImage = this.getProfileImage()[0]
    window.profileImage = this.profileImage
}

getProfileImage(){
    return Images.find().fetch()
}

render(){
    console.log(this.profileImage.url({store:"images",uploading: "./user.jpg"}))
    return(
        <div>
            <div className="row">
                <div className="flex-container">
                    <div className="flex-child">
                        <img src={FlowRouter.subsReady('images') ? this.profileImage.url({store:"images",uploading: "./user.jpg",auth: false}) :  "./user.jpg" } className="img-responsive" id="home-profilepic" alt=""/>
                    </div>
                    <div className="flex-child">
                        <h4 className="bold" id="home-firstandlast">
                            {FlowRouter.subsReady('userData') ? Meteor.user().profile.firstAndLastName : 'Loading'}
                        </h4>
                        <p id="home-username" className="bold">
                            {FlowRouter.subsReady('userData') ? Meteor.user().username : 'Loading'}
                        </p>
                        <p id="home-bio">
                            {FlowRouter.subsReady('userData') ? String(Meteor.user().profile.bio) : 'Loading'}
                        </p>
                    </div>
                </div>
            </div>

            <br/>

            <div className="border"></div>

            <br/>

            <div className="row">
                <div className="flex-container center-text">
                    <div>
                        <p className="bold">Followers</p>
                        <p>
                            {FlowRouter.subsReady('userData') ? String(Meteor.user().profile.contacts.followers.length) : 'Loading'}
                        </p>
                    </div>
                    <div>
                        <p className="bold">Following</p>
                        <p>
                            {FlowRouter.subsReady('userData') ? String(Meteor.user().profile.contacts.following.length) : 'Loading'}
                        </p>
                    </div>
                    <div>
                        <p className="bold">Podcasts</p>
                        <p>20</p>
                    </div>
                </div>
            </div>
        </div>
    )
}

错误503表示服务不可用,服务器过载。
您可能需要检查应用程序中的一些内容

  • 检查您的发布方法
  • 订阅该组件中的数据以确保您能够获取数据,您可以使用
  • 如果您可以确认您的图像存储在文件系统中,那么使用react,您可以通过图像id轻松获取图像。如果您知道图像id,那么您可以直接链接到组件中,您将必须检查并确保图像实际存储

    <img src={`/uploads/media-${file._id}-${file.original.name}`} alt='' />
    
    
    
    media
    在这种情况下,将是您保存图像参考的集合的名称。
    文件
    是包含所有元数据和有关图像的任何其他内容的图像对象

    检查一下我的反应

    CollectionFS已经有一段时间没有维护了

    <img src={`/uploads/media-${file._id}-${file.original.name}`} alt='' />