Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage images #493

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Manage images #493

wants to merge 2 commits into from

Conversation

Luc-cpl
Copy link

@Luc-cpl Luc-cpl commented Apr 7, 2018

Add the possibility to use images that is already in the system unstead upload a new image every time.

The image source is an array of strings with the src
To set the images is just put this array in IMAGE_UPLOADER dialog new function "addImages"

add functions to let the user pass images already in the file system through an array that contains URLs to that images (dialog.addImages( [ "url1", "url2" ] ) )
Add css for images dialog
@PawelGlow
Copy link

@Luc-cpl can you provide an example in JS how to add the images? I can then confirm I implemented it correctly and check if it works as expected.

@Luc-cpl
Copy link
Author

Luc-cpl commented Apr 20, 2018

Following the "Handling image uploads" tutorial.

function imageUploader(dialog) {
    var image, xhr, xhrComplete, xhrProgress;

    var myImages = [ '/image1.jpg', '/image2.jpg', '/image3;jpg', '/image4.jpg' ]; //or use any function that return an array with the urls

    dialog.addImages(myImages);
    
    // Set up the event handlers
    ... event handlers go here ...
}

ContentTools.IMAGE_UPLOADER = imageUploader;

Add one if statement in save event:

dialog.addEventListener('imageuploader.save', function () {
    if (!image){
        dialog.save();
        return;
    }

    // Rest of code ....

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants