Jump to content

[Resolved] Inserting an image in CKE WYSIWYG does not populate src Attribute


Recommended Posts

Hi,

Quote

This was resolved -- see answers below for fix and description

this is the first time i'm encountering the issue on any site i built with processwire and i'm running out of ideas -- so maybe someone had the same issue, i also added a short recording:

The issue is that when using CKE Editors "Image" functionality in a field it creates the HTML but doesnt add the URL of the Image to the src attribute, so i more or less have a broken image tag in the code which my content manager cant see.

  • I already tried removing all modules (like fluency) and reset all settings that could interfere on this "body" field like customstyles and functionality.
  • This also doesnt happen because it interfers with pro fields matrix or something else
  • It's on live and localhost
  • It doesnt throw any error or warning in console
  • Edit: It happens accross Firefox & Chrome

I'm out of ideas on how to debug, so any suggestion is highly welcome!

Link to comment
Share on other sites

Create (not copy/clone the existing one) a new image field with the exact same settings and try if it still doesn't work.

I guess you already tried different images? Just in case. 😂
Does the file really exist in the file system? Correct mime-type?

Just check if there is some weird setting in the body field. Maybe even create a new body field.
Are there any textformatters applied?

Is there anything in the logs?

As you see... just wild guesses but that's how would look for issues and you already tested quite a lot.

 

  • Thanks 1
Link to comment
Share on other sites

thank you very much, this pointed me in the right direction, i would have simply not though about logs for this issue 😅

I do have this as an issue in "errors" log, will further invesigate, but maybe there is some additional insight

unlink: Given filename is not a file or link: /site/assets/cache/WireTempDir/.PFM0.03872100T1715620700RMFKVerOqVFC/0/share-it.1200x0.png-tmp.png

my current best guess is something with webp functionality

Link to comment
Share on other sites

Well what can i say... it's resolved, but if anybody comes across the same issue:

apart from using this in config.php

$config->imageSizerOptions('webpAdd', true);
$config->contentTypes('webp', 'image/webp'); 

i'm also using the function provided here https://processwire.com/blog/posts/webp-images-and-more/ within ready.php

if($page->template != 'admin') {
    $wire->addHookAfter('Pageimage::url', function($event) {
        static $n = 0;
        if(++$n === 1) $event->return = $event->object->webp()->url();
        $n--;
    });
}

i dont know how, but this function ended up broken (so not like the correct one above) in my code and therefore did not exclude the processwire backoffice part and conflicted with the editors. everything back to normal now. thanks for the input!

Link to comment
Share on other sites

  • overoon changed the title to [Resolved] Inserting an image in CKE WYSIWYG does not populate src Attribute

Wohoo! Awesome.

// my ready.php
if ($page->template != 'admin') {
    $wire->addHookAfter('Pageimage::url', function ($event) {
        static $n = 0;
		// slightly different here
        if (++$n === 1) {
            $event->return = $event->object->webp()->url();
        }
        $n--;
    });
}

 

Link to comment
Share on other sites

yeah my issue was that the $page->template if was somehow in the $wire Hook, which then of course isnt in scope so it always executed this... dont know how i messed up copy+paste 😅

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...