GithubHelp home page GithubHelp logo

Comments (5)

johndatserakis avatar johndatserakis commented on July 27, 2024

Hello,

In your example I can't see exactly where you're initializing you backgroundImage base64 image, so I can't say for sure that there's not a problem with that base64 string.

I can say that we have a really nice example in the ./example folder where we load a .svg as the baseImage for an input. You can see this live in the demo page on the right box (just remove the preloaded images and you'll see the baseImage). Take a look at the ./example folder code to see exactly how that is coded.

My advice would be for you to first set up the baseImage using a local image option, like a local .png or .svg, then, once you have that working correctly and you know everything is set up well, you can work on getting the base64 version to work, as it should really not require any further updates.

Let me know if you still have trouble, thank you.

from file-upload-with-preview.

sanoj26692 avatar sanoj26692 commented on July 27, 2024

Instead of using external file is the any inbuilt solution. Or can i use CSS like using background-color: ?
because i tried this

 const importedBaseImage = require('./download.svg'),
                    var upload = new FileUploadWithPreview('myUniqueUploadId', {
                        maxFileCount: 4,
                        text: {
                            chooseFile: 'Maximum 4 Images Allowed',
                            browse: 'Add More Images',
                            selectedCount: 'Files Added'
                        },
                        images: {
                            baseImage: importedBaseImage,
                        },
                    });

i get error here var upload = new FileUploadWithPreview('myUniqueUploadId', {

saying Uncaught SyntaxError: Unexpected token 'var'

from file-upload-with-preview.

johndatserakis avatar johndatserakis commented on July 27, 2024

Hello, no - at the moment you cannot use a background-color for this.

In your example, I think you need to remove the , after the first line - that's why you're getting the error message. So, make it like this, it should work:

const importedBaseImage = require('./download.svg');
var upload = new FileUploadWithPreview('myUniqueUploadId', {
  maxFileCount: 4,
  text: {
    chooseFile: 'Maximum 4 Images Allowed',
    browse: 'Add More Images',
    selectedCount: 'Files Added'
  },
  images: {
    baseImage: importedBaseImage,
  },
});

from file-upload-with-preview.

sanoj26692 avatar sanoj26692 commented on July 27, 2024

Tried above method and got this error,

car.php:377 Uncaught ReferenceError: require is not defined
(anonymous) @ car.php:377

after little research found this https://stackoverflow.com/questions/45723462/javascript-error-uncaught-referenceerror-require-is-not-defined

is there any solution without using external library ?

from file-upload-with-preview.

johndatserakis avatar johndatserakis commented on July 27, 2024

I think has to do with an error in the formatting of your javascript in your .php file. Check your script tags as that may help. I'll close this for now, thanks.

from file-upload-with-preview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.