Wrong image URL in panel

Hello,

i have a strange panel problem:

if i enter a edit page view in the panel over “overview” i get a wrong URL for images in a structure field.
After reloading the page or opening it over the top breadcrump nav… the URL is correct.

hard to describe… look at the GIF:

i’ve “hardwired” the URL in the blueprint like this:

  authors:
    label:
      de: Autoren
      en: Authors
    type: structure
    entry: >
      <img src="../../../content/1-blog/{{image}}" style="height:40px"> <b>{{name}}</b>
    fields:
      name:....

Any ideas why the URL differs and how to fix this?

best regards,
Sven

You could use the Snippetfield by @jenstornell to display the image: https://github.com/jenstornell/kirby-snippetfield

Even stuff like ->resize() or ->crop() works in there and you have a lot more freedom in customizing the entry.

thanks,maybe i’ll try it next week.

But it seems this is a bug in the panel?

S.

I don’t really understand why it only works the second time. But can you try the following?

<img src="../../../blog/{{image}}"/>

You don’t really need the content folder or the sorting number in there anyway.
In my installation it works with your code, too. But I don’t have Kirby in a subfolder and maybe that’s what causes the problem? It seems like the kirby/ folder is missing in your GIF.

With your code i got the same results: coming from Overview… no image, reload or breadcrump…image!

i’ve also a router running that removes the “blog”-folder in the URL:

c::set('routes', array(
  array(
    'pattern' => '(:any)',
    'action'  => function($uid) {

      $page = page($uid);

      if(!$page) $page = page('blog/' . $uid);
      if(!$page) $page = site()->errorPage();

      return site()->visit($page);
    }
  ),
  array(
    'pattern' => 'blog/(:any)',
    'action'  => function($uid) {
      go($uid);
    }
  )
));

but after removing the router i got the same result: no images if clicked blog in overview.

I also checked the links in Overview and Breadcrumb: they are the same… http://localhost/kirby/blog/panel/pages/blog/edit

S.

If you add the subfolder to the path, it should work.

entry: >
    <img src="/kirby-folder/blog/{{image}}" style="height:40px"> <b>{{name}}</b>

Nope. I have tried it on two other webservers because i don’t trust the ZendEnvironment here @work.
But the same results there: coming from overview… no image. reload or click breadcrumb: image.

:frowning:

Hm, it worked for me in my environment, but I have only tested on localhost.

two more screenshots:

coming from overview:

reload or click on breadcrumb:

this is sooo strange… i’m lost :frowning:

It works for me, too. I even installed Kirby in a subfolder and added a RewriteBase but I still can’t reproduce this error.

Looking at your screenshots it does seem like the kirby folder is missing. So using the absolute code @texnixe suggested must work. For you it would be:

<img src="/kirby/blog/{{image}}" style="height:40px"> <b>{{name}}</b>

gives no image… even after reload… the URL is <img src="/kirby/blog/imagename.jpg" style="height:40px"> wich is wrong.

i’ll try it in a clean new kirby install now.

I think I found the mistake. The installation is in /kirby/blog and not just /kirby.
Does this work?

<img src="/kirby/blog/content/1-blog/{{image}}" style="height:40px"> <b>{{name}}</b>

yes. it works now. So i have to change the URL after going live.

But it still strange that the relative URL want work at first load.
You can try it here: https://drive.google.com/open?id=0BzxWXv-eYUXuaGRWOU5oRmFyaHc

It’s a plain kirby install with just the images and a blogoverview.yml template.

Thx dude!

best regards,
Sven

Overall the structure field entry is not intended to display images, so it really is sort of a hack. Once the client changes the uid for example, no images would be displayed.
You should really have a look at the snippetfield I mentioned earlier. It’s the same thing just using snippets as the entry.

I just tested it on your installation and it works flawlessly by the way:

i’ll do so.

that’s super strange… but anyway.

thx a lot!