Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » No external hosted images in TinyMCE? :-(

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1 2
Go to End
Author Topic: 32991 Views
  • dio5
    Avatar
    Community Member
    501 Posts

    No external hosted images in TinyMCE? :-( Link to this post

    I think this is a major flaw/bug, but it seems that the TinyMCE in the cms doesn't
    allow embedding of images that are hosted externally?

    Try to paste this code in the html-mode of the SS TinyMCE and save:

    <a href="http://www.flickr.com/photos/dieterorens/2055245161/" title="Untitled by dio5, on Flickr"><img src="http://farm3.static.flickr.com/2184/2055245161_e8b3519dff_m.jpg" width="240" height="161" alt="" /></a>

    You end up with an image that doesn't have a src-attribute in the TinyMCE, and an empty src on the frontend.

    Why isn't there an option to choose external embedding. Now it seems we can only use images that are on the same site. And who doesn't include flickr-images??

    This is pretty critical for me. The thing I'm building is for someone who's used to wordpress. Wordpress easily allows this, has YouTube embedding (no I don't want the widget/module.. ) etc...

    How can I explain this to him? Not being able to include flickr imagelinks is quite incomprehensible...

  • Tim
    Avatar
    Core Development Team
    201 Posts

    Re: No external hosted images in TinyMCE? :-( Link to this post

    The Flickr gallery module may be what your after.

    - Tim

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: No external hosted images in TinyMCE? :-( Link to this post

    No, that's not what I'm after, thanks.

    I just want to be able to insert an image that's not uploaded in SS and not in the uploads folder, whether it's from flickr or whatever.

    I just found out a very dirty hack that does the trick:

    Comment out line 220 of HTMLEditorField.php.
    like this:

    else {
          //$parts[$partSource['src="']] = "";
       }

    Now it doesn't reset other urls to "".

    Of course this is not a very sound way, because it still allows resizing in the content field, etc that won't work...

    There should be a way to just include/embed an external image. I think this is just forgotten and I hope this will be tackled in the upcoming version.

    Now I got to find out why and where it strips out empty alt attr's.

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: No external hosted images in TinyMCE? :-( Link to this post

    Couldn't immediately find where empty alt-attributes are stripped, so I just added something to HTMLEditorField, right before the return statement:

    if(strpos($result, "alt=") === false)
    {
    $result = substr_replace($result, ' alt="" />', -2);
    }

    Now the code is also clean when people don't fill out the description field when inserting 'local' images.

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: No external hosted images in TinyMCE? :-( Link to this post

    Thanks for the hacks ... Need them also ..

    It seems that only once (end)users are really starting to work with SS, these little bugs get filtered out..

    I didn't even notice it myself, a client had to point it out.

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: No external hosted images in TinyMCE? :-( Link to this post

    Thanks, dio5. I've committed the patches that you suggested to trunk.

    In time, we may have better support for external images, so that, for example, the image dialog knows how to handle them. But for now, the changes you made to the job.

    You can see the change here: http://open.silverstripe.com/changeset/47827

    It will make its way into 2.2.2.

  • stigm
    Avatar
    Community Member
    1 Post

    Re: No external hosted images in TinyMCE? :-( Link to this post

    This is a nightmare... Not only is there no external hosted images in SS, I cannot sensibly add images to content without the images becoming links to a 'full size' version of the image. This happens when there is no resizing of the image done at all.

    Also when someone right clicks on an image they can edit the image using the traditional TinyMCE popup and not the rhs SS image tab - where they are presented with a bizzare set of details like:

    Image URL: assets/Uploads/Custom-Page-Resources/12-2.jpg?r=556
    Alignment: --not set--
    Vertical space: nul
    Horizontal Space: nul

    The image HAD alignment which is now lost.

    I am trying to finish a SS CMS driven site to present to the client next week for them to start putting content live - but at this stage it will just turn into a big nasty image mess!

    Someone needs to redesign the entire image tab system to something that actually works... My ass is on the line here! This is a test case for using SS as the in-house CMS for small projects.

    Please SS fix this so we can use SS CMS!

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: No external hosted images in TinyMCE? :-( Link to this post

    The resize functionality is indeed broken. Resizing images used in the TinyMCE content just doesn't work through Internet Explorer. It's very hard to explain that to customers.

    In FireFox all is good by the way.

    32991 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.