Migrating images from my old site structure


#1

I’m looking for a little high-level advice. I have an existing image structure that’s mostly flat, which is located at /images.

I know that in Kirby, you would typically put images in the folder of the page they go with, or perhaps under the assets folder for global-use images.

My dilemma is that I have a bunch of img srcs in articles that I would rather not have to change (I’m trying to maintain URL longevity). On the other hand, I’m missing out on Kirby features aren’t I? It would be cool to use the panel for image management. And access template helpers for displaying images. But that doesn’t work with my existing structure does it?

What would you guys do in this situation? Move the images to Kirby’s preferred structure and use redirects for the old URLs? Or can I configure Kirby to use my existing structure? Am I just overthinking it? #confused


#2

You can have it both ways, put all images into their page folders, or have them all in one folder.

The downside of the “all-in-one-folder” approach is that you can’t drag&drop images into an textarea field, but have to write out the links manually, or find a plugin that allows you to pick images from a folder, or use a content structure where you just select images.

If feasible, I’d put them into the corresponding page folders and either replace the old links or reroute them. In the long run, you’ll have more fun that way.


#3

Thanks for the advice! I’m definitely leaning that way. I’ve used Kirby here and there since version 1, but I’ve never really used the panel. I want to do things the “Kirby way” this time around.


#4

I had a similar issue a long while back, with wanting to keep all my images in a single pot. Just to save you some time if you think of trying this your self - I went with creating Symbolic links via panel hook on page creation to link the page up to the images folder. This worked great for a while but certain panel actions destroys the sym link and i ended up deleting the files accidentally because the panel followed the symlink back and deleted the original which broke some other pages that used that image…it was a brave idea, but don’t go there.

You don’t say which Kirby version you are using. This is tricky in Kirby 2 but Kirby 3 has queries now that allow you to pull stuff very easily from other parts of the site. Perhaps an upgrade might be in order… :slight_smile: