Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- Includes AppVital file uploader into your code -->
<script src='https://cdn-apps.appvital.com/app/fpicker/1.0.0/fpicker.min.js'></script>

<button id='btnShowFileUploader' class='btn btn-primary m-2'>
  Test Drive: Photo Upload + Watermark
</button>
  
<div id='fileContainer' class='m-2'></div>

<script>
  //STEP 1 - replace YOUR_APPLICATION_KEY with a key obtained from https://appvital.com/dashboard
  const picker = new ApvFilepicker('YOUR_APPLICATION_KEY');

  //STEP 2 - have a function that opens file uploader with required options
  function showFileUploader() {
      const filePickerOptions = {
      multiple: true,
      onUploadDone: onUploadDone,
      outputfileoptions: {
        width: 500,
        height: 281,
        resizetype: "fit",
        resizeconflict: "crop",
        watermark: {
          type: 'image',
          url: 'https://cdn.appvital.com/apv-demo-watermark/demo-watermark.png', //your watermakr image url here
          position: 'bottomright',
          margin: 30,
          opacity: 0.8,
          scale: 1.0, // 0.1-10
          rotate: 0, //0-360 
          repeat: "no-repeat" //repeat | repeat-top| repeat-bottom| repeat-middle | repeat-brick
        }
      },
      inputfileoptions: {
        allowedfileformats: "jpg,jpeg,png",
        note: 'File type restricted to: JPG, JPEG, GIF and PNG.'
      }
    };

    //open file uploader
      picker.open(filePickerOptions)
  }

  //STEP 3 - function to hook up with onUploadDone callback which receives
  //an array of file metadata object containing file details. 
  function onUploadDone(data) {
    if (!data.files) return

    const listMarkup = data.files.map(obj => {
      // switching to no-cache cdn for demo only
      const fileURL = `${data.cdnRoot.replace('cdn.', 'cdn-no-cache.')}${obj.fileName}`
      return `<a href='${fileURL}' target='_blank'>${fileURL}</a>`
    })

    document.getElementById('fileContainer').innerHTML = listMarkup.join('<br/>')
  }

  // STEP 4 - invoke function to open file picker
  const button = document.getElementById('btnShowFileUploader')
  button.onclick = showFileUploader
  
</script>


<!--
API          https://appvital.com/Docs/file-uploader

Examples:
* JavaScript https://appvital.com/example/cloud-file-uploader
* Angular    https://github.com/AppVital/file-upload-widget-api-angular
* React      https://github.com/AppVital/file-upload-widget-api-react
-->
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console