This example shows how to enable selection of already uploaded images in Redactor X. See the documentation for more details.
<!DOCTYPE html>
<html>
<head>
<title>Redactor X</title>
<meta charset="utf-8">
<!-- css -->
<link rel="stylesheet" href="/your-dist-path/redactorx.min.css" />
</head>
<body>
<!-- element -->
<textarea id="entry">
<p>Content</p>
</textarea>
<!-- js -->
<script src="/your-dist-path/redactorx.min.js"></script>
<!-- call -->
<script>
RedactorX('#entry', {
image: {
upload: '/image-uploader-path/',
select: '/images/images.json'
}
});
</script>
</body>
</html>
JSON of images should be like this:
[
{
"thumb": "/images/image-thumbnail-1.jpg",
"url": "/images/image-1.jpg",
"id": "1",
"title": "My Image 1"
},
{
"thumb": "/images/image-thumbnail-2.jpg",
"url": "/images/image-2.jpg",
"id": "2",
"title": "My Image 2"
}
]
When id
and title
parameters are optional.