Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
Implementing Cloudinary product gallery in React.js

In the code, I have fetched data from the backend through axios. I want to display the cloudinary product gallery dynamically from the public IDs fetched from the database. I used the cloudinary documentation for the product gallery code. In the axios get method I get a json object which has "sampleimg" array which contain the public Ids, and I have set that json object to the data state. In the current code I have mapped the "sampleimg" array inside the mediaAssets method but it gives me this error code.Uncaught (in promise) Error: 🌧🌧🌧 Cloudinary Product Gallery Configuration: one or more of your configuration values are not valid: 🌧🌧🌧an error with the definition of your media asset Please help me with this error.

import React, { Component } from 'react';
import axios from 'axios';

class Details extends Component {
state = { 
    data: { }
 } 

async componentDidMount(){
    let data = await axios.get('/admin/movies')
    let lands = [...data.data]
    let land = lands.find(l => l._id === this.props.match.params.id)
    this.setState({data: land})

    const mywidge = window.cloudinary.galleryWidget({
        container: "#my-gallery",
        cloudName: 'CLOUDENAME',
        mediaAssets:[ 
            this.state.data.sampleimg.map(id => (
                {
                    publicId: id,
                    mediaType: "image"
                }
            ))
         ],
         zoom: false, 
         transition: "fade",
         carouselStyle: 'none',
         
    });
    mywidge.render()
}

render() { 
    return (
        <div style={{paddingTop: '80px'}}>
        <div id='my-gallery'>
            
        </div>
        </div>
    );
}

}

export default Details;

about 4 years ago Β· Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
Β© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!