Share images cross-page from within the editor

In Kirby all images are attached to a page - besides the images, attached to the “site” (those can be used “site wide”).

###Take a look at this situation;

  1. I have page A) and I upload image X) to page A).
  2. I drag and drop image X) from the files-panel into my text-box.
  3. Now page A) contains image X).
  4. I create another page - page B) and I want image X) also on that page.
  5. How can this be done, using the “drag and drop” file-panel (from page A).

In CMS’es like WordPress you have one centralized image-library and every single page can get it’s images from that library, using a drag/drop action;

Can this be done in Kirby?

  1. I don’t want to upload image X) twice (for both page A) and page B)).
  2. I want to add image X) to page B)visually” (for my client), not by code / blueprint / etc…

If you need a drag and drop action, this is currently not possible.

Okay - cool.

I don’t really need (persé) drag and drop;

If there’s any code I can use, it’s okay for now (but I mean code, that I can use in the text-editor; I don’t care writing php / phyton / ruby on rails or java… but my client does :slight_smile: )

Is there any code, I can use for placing images from page A) into page B)

( image:{page A} src:myimage.png )

…something like that?

In Kirby 2.2.3 Panel we have drag & drop of pictures:

I think you can simply use the image tag with the path to the file

(image: projects/project-a/myimage.jpg)

But you cannot drag and drop images from another page into the textarea field of the current page, that is what @1n3JgKl9pQ6cUMrW was asking.

Thanks - But I also want to “drag and drop” the image “mountains.jpg” from “Project B” into “Project C”.

So I upload an image once, and want to “drag and drop” it into several pages…

Or use a Kirby-tag in the text-area to realize this… (a centralized image-library would be great; so you can upload / attach images to one specific page, and share it afterwords to other pages).

Cool - will use that one :slight_smile:

Only problem is when the URI changes, but I think this also triggers a problem, using the drag and drop operation.

I think this threat is solved, with your answer!

For a current project which I migrated from Joomla, I have put all the images into a central store and mainly use selects to fetch them into a page; but also direct links to the file via image tag.

What do you mean by

mainly use selects to fetch

Can I create a fieldtype in the back-end that “fetches” all images attached to one page (or the site)?


##solution

See the last Kirby-tag in the text-field; it works great, using this code;

(image: home/avatar.png)

Yes, the global field definiton looks like this, it fetches the images from a page called mediastore which in turn has two subdirectories called images and pdf:

label: Banner Image
type: select
options: query
query:
  page: mediastore/images
  fetch: images
  text: '{{filename}}'
  value: '{{filename}}'

But this only makes sense if you have a separate image field and don’t need to have the image within a textarea field:

1 Like