Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Any solution to find and use the uploaded images in article?
Awesome, thank you. I’ve been busy with com_connect too :)
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
Online
Re: Any solution to find and use the uploaded images in article?
Done as a pre-release version, testers/help contributors welcome. Remove (or change .php
extension of) the cached version first. Will probably not work in multi-site setup atm, we need to tweak PLUGINPATH
or introduce PLUGINURL
constant in core.
Offline
Re: Any solution to find and use the uploaded images in article?
etc wrote #335066:
Done as a pre-release version.
Awww, no commits? Thanks for the release though, I’ll give it a run through when I get a chance.
Will probably not work in multi-site setup atm, we need to tweak
PLUGINPATH
or introducePLUGINURL
constant in core.
I thought it already took advantage of multi-site? Or do we need to do more beyond this:
if (!defined('PLUGINPATH')) {
global $txpcfg;
$admin_path = (isset($txpcfg['multisite_root_path'])) ? $txpcfg['multisite_root_path'].DS.'admin' : txpath;
define('PLUGINPATH', $admin_path.DS.'plugins');
}
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
Online
Re: Any solution to find and use the uploaded images in article?
Bloke wrote #335067:
Awww, no commits? Thanks for the release though, I’ll give it a run through when I get a chance.
I’m totally ignorant of Git workflow, if anybody asked :-/
I thought it already took advantage of multi-site? Or do we need to do more beyond this:
Yep, but this is a fs path, not always suitable in URL (to access plugin assets like css
an js
).
Offline
Re: Any solution to find and use the uploaded images in article?
etc wrote #335068:
this is a fs path, not always suitable in URL.
True. If we need something to get to plugin resources then it’ll be damn useful I’m sure.
Edit: I suspect introducing a new convention here for the layout of a plugin folder would be beneficial. We already have a loose spec, but if we document it and make it concrete then it makes core’s job easier to define paths to find stuff within it. E.g. manifest file, php source, help, scripts, styles etc.
Last edited by Bloke (2023-03-13 16:43:48)
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
Online
Re: Any solution to find and use the uploaded images in article?
Plugin works OK, I think. The search is a little puzzling though. I input an image “name”, press return; it appears to load a bunch of images not necessary related (I don’t have many images uploaded on the test site).
2 issues:- if the site uses custom path to the plugins folder (in my case,
domain.local/core_plugins
, defined in config.php), the path to the stylesheet and script is wrong (it looks for/textpattern/plugins…
) - at my first attempt, script and styles were blocked… Could you please, in a next version, make the script and style blocks CSP aware? Example by Stef on one of his plugins.
After downloading from GitHub, I installed the plugin by uploading the whole zip folder through the TXP admin UI.
Last edited by phiw13 (2023-03-14 05:50:31)
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: Any solution to find and use the uploaded images in article?
I have uploaded v.0.4 (zip only atm), please test.
What’s new?
Image search fields
pref. If empty, will use the search options ofImages
tab (as in v.0.3).- Search results can be scrolled with
Down
andUp
keys and reset withEsc
. - Minor improvements and bugfixes.
The plugin directory is still hard-coded, since I was not able to use PLUGINPATH
constant in URL. Change it in the code if needed, will fix later.
Offline
Re: Any solution to find and use the uploaded images in article?
This works nicely now – both the Upload part and the Find part. I tested this on my normal playground with 300+ images. Find: e.g type 2 digits and I get –quickly– a list of possible images.
One small UI suggestion: limit the height of the image containers (in case there are multiple images in the article_image field):
#article-file-container, #article-file-select {
max-height: 40vh;
overflow:auto;
}
Oh, and check, CSP! For the inline onchange="comArticleImagePreview(this)"
, here is the hash for the script-src-attr
SHA256-S0Fa8QCxrGu3S55pAHU+jjOoI1PaLPGe2nF4gsfG3zA=
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: Any solution to find and use the uploaded images in article?
phiw13 wrote #335076:
One small UI suggestion: limit the height of the image containers (in case there are multiple images in the article_image field):
Good idea, certainly better than limiting the number of visible images via CSS. Will test, thanks.
Oh, and check, CSP! For the inline
onchange="comArticleImagePreview(this)"
, here is the hash for thescript-src-attr
That’s an old days relics, I will rather move it to a listener.
Offline
Re: Any solution to find and use the uploaded images in article?
etc wrote #335078:
That’s an old days relics, I will rather move it to a listener.
That would be even better. TY.
Last edited by phiw13 (2023-03-15 09:20:08)
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: Any solution to find and use the uploaded images in article?
Okay, updated, seems to work fine. Please test, if everything is ok I will do some clean up.
News:
- Scrollable image areas, change its height in
style.css
if needed. - Deletable images in the image select area.
Add
link to append all filtered images at once.
Offline
Re: Any solution to find and use the uploaded images in article?
Overall, it works great
One small issue that you probably know: $pluginpath
for the script – it works great for the stylesheet. The path for the script is still hard coded; I managed to get $pluginpath
working for the script, but I had to repeat the code block
plugin function js()
{
global $img_dir, $path_to_site;
$pluginpath = str_replace($path_to_site, '..', PLUGINPATH);//dmp($pluginpath);
// and then add $pluginpath to the path.
More UI goodness: scroll snap
on the image containers:
#article-file-container,
#article-file-select {
scroll-snap-type: y mandatory;
}
#article-file-container p,
#article-file-select p {
scroll-snap-align: start;
}
When scrolling the image “snaps” to the top edge of the container. BTW, consider adding a shared class to those two image containers; that makes it easier to write styles.
And thank you for removing the inline js thingie. This quickly becomes a model plugin for CSP handling in plugins.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline