Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-04-08 04:17:28

Summer
Member
Registered: 2018-01-29
Posts: 60

Insert picture

Is there a method or plug-in for quickly inserting an image in an article?

Offline

#2 2018-04-08 08:02:21

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,273
Website GitHub

Re: Insert picture

Yes there are plugins available but it depends what you mean by ‘insert’.

Do you mean drag ‘n drop one ore more new images into the Write panel? abc_article_image or abl_droploader will do that.
Do you mean select one or more from those you’ve uploaded already? Try bot_image_upload.
Do you want to manage galleries of images and insert/edit them in your articles? smd_imagery is the right choice.

And there are many others. It all depends what you want to do.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2018-04-08 08:55:25

Summer
Member
Registered: 2018-01-29
Posts: 60

Re: Insert picture

Bloke wrote #310758:

Thank you, Bloke.

Offline

#4 2018-04-08 09:35:22

etc
Developer
Registered: 2010-11-11
Posts: 5,057
Website GitHub

Re: Insert picture

Hmm, in 4.7 abc_article_image (and probably others too) has lost upload_image string, not available on Write tab anymore.

Edit: Plugin Composer outputs the raw plugin_saved string too. Something needs to be done here.

Offline

#5 2018-04-08 09:46:56

Summer
Member
Registered: 2018-01-29
Posts: 60

Re: Insert picture

These plug-ins do not completely insert the picture anywhere in the article content.

The tom_write_editor editor plugin solves the problem of inserting an image at any time in an article. The disadvantage is too bloated.
Other editors can only reference network images.

Offline

#6 2018-04-08 12:26:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,273
Website GitHub

Re: Insert picture

etc wrote #310764:

Hmm, in 4.7 abc_article_image (and probably others too) has lost upload_image string

Needs to be in the [admin-side] group to be available to the menu.

Plugin Composer outputs the raw plugin_saved string too.

Plugin composer is in dire need of fixing. I did some more work on it last night to help get the Textpack support up to scratch. Still a way to go yet.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2018-04-08 12:30:02

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,273
Website GitHub

Re: Insert picture

Summer wrote #310765:

These plug-ins do not completely insert the picture anywhere in the article content.

Which is why I mentioned a few options. Traditionally, Txp associates images with an article via the article image field. Your template then takes care of displaying them before or after your <txp:body>. If you want them to appear inline then yes you need a plugin such as smd_imagery which will generate you a tag that you can insert where you want it within your article copy text.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#8 2018-04-08 16:04:51

etc
Developer
Registered: 2010-11-11
Posts: 5,057
Website GitHub

Re: Insert picture

Bloke wrote #310772:

Needs to be in the [admin-side] group to be available to the menu.

Plugin composer is in dire need of fixing. I did some more work on it last night to help get the Textpack support up to scratch. Still a way to go yet.

I didn’t mean a specific string/plugin. Just any admin-side plugin using core strings outside of their “normal” context may be concerned.

Offline

#9 2018-04-08 19:44:07

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,273
Website GitHub

Re: Insert picture

etc wrote #310781:

I didn’t mean a specific string/plugin. Just any admin-side plugin using core strings outside of their “normal” context may be concerned.

Yes, definitely something to be aware of. There’s nothing to stop a plugin loading strings from other panels:

// Fetch a reference to the language class if you don't already have one.
$langObject = \Txp::get('\Textpattern\L10n\Lang');

// Extract strings from the given groups from the installed pack.
$strings = $langObject->extract('<langDesignator>', array('article', 'image', 'prefs', ...));

// Set the internal strings to use them.
// true = append to what's already loaded, false = replace entirely.
$langObject->setPack($strings, true);

The alternative is just for core to revert to loading everything everywhere. Simpler but… memory/resource expensive. Picks your poison!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2018-04-09 07:37:33

etc
Developer
Registered: 2010-11-11
Posts: 5,057
Website GitHub

Re: Insert picture

Bloke wrote #310787:

There’s nothing to stop a plugin loading strings from other panels…

The alternative is just for core to revert to loading everything everywhere. Simpler but… memory/resource expensive. Picks your poison!

I’m all for resource preservation, but we should leave plugin authors a cycle or two to comply with the new mechanism. Probably, if a string is not found on the admin side, load everything (once) with a warning?

Offline

#11 2018-04-09 08:42:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,273
Website GitHub

Re: Insert picture

etc wrote #310797:

we should leave plugin authors a cycle or two to comply with the new mechanism. Probably, if a string is not found on the admin side, load everything (once) with a warning?

Maybe. We already load all plugin strings regardless of event. We just don’t load strings from other core events unless asked.

If you can determine if a request for a core string (not a plugin string: that’s covered already) has failed, then sure, load everything. Not sure what you mean by ‘once’ though. Language strings are already loaded once every page and stored for any further requests on that page.

A warning is a nice idea in non-production modes as it also alerts plugin authors to the changes directly.

By all means have a play with it to make it better.

Last edited by Bloke (2018-04-09 08:42:21)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#12 2018-04-09 11:24:14

etc
Developer
Registered: 2010-11-11
Posts: 5,057
Website GitHub

Re: Insert picture

Bloke wrote #310803:

We already load all plugin strings regardless of event. We just don’t load strings from other core events unless asked.

That’s exactly the problem: a pre-4.7 plugin using a core string from some other event will miss it. Loading the whole pack in this case is easy, of course, but annihilates this nice “load only what is needed” idea. Loading a string “on demand” is another possibility, but could result in zillion db queries. I’m almost going to try parsing plugins code for gTxt() calls on install and append all found strings to the pack, but this looks a bit weird. Dunno…

Offline

Board footer

Powered by FluxBB