Coder Social home page Coder Social logo

skinysmn / cnbolt-extensions-imageupload Goto Github PK

View Code? Open in Web Editor NEW

This project forked from condenastdigital/cnbolt-extensions-imageupload

0.0 2.0 0.0 444 KB

Extension to upload multiple images with metainformations

PHP 48.88% HTML 8.20% CSS 11.06% JavaScript 31.86%

cnbolt-extensions-imageupload's Introduction

cnBolt-Extensions-Imageupload

Bolt Extension to upload multiple Files (Images) with meta-informations. This extension uses a configured contenttype for your images and created/updates these objects and stors a list of ids as a json string in the field.

You have to click on the "Update" Button inside the field to update the changed images. Only saving the page containing the field will not update the images themselfes but only the links to them!

Note: the field only stores je ids as a json string. Your template needs to parse the string and fetch the images itself. See sample below.

Configuration

Add a contenttype for your image objects similar to the one shown here (within contenttype.yml).

image:
    name: Images
    singular_name: Image
    fields:   #add the fields you need in your content type (metainformations)
        title:  #mandatory
            label: Name
            type: text
        copyright:
            type: text
        author:
            label: Autor
            type: text
        image:   #mandatory
            type: image

Add the following field to the contenttype where you want to add the images to. E.g. in pages:

page:
    name: Pages
    singular_name: Page
    fields:
        imageupload:
            type: imageupload
            contenttype: images   #must be the same name as the new defined contenttype above

Usage

Within your twig template, you may access the content type field which comes in form of an JSON string. There is a custom twig filter, which converts the JSON string into an array. Here is an example, how to fetch the content elements within a twig template:

{% set images = record.imageupload|json_decode %}

{% for image in images.content %}
    {% setcontent currentElement = image %}
    {{ dump(currentElement) }}
{% endfor %}

cnbolt-extensions-imageupload's People

Contributors

tobe998 avatar cndforster avatar

Watchers

James Cloos avatar  avatar

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.