Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1177 2016-05-26 07:04:27

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 276

Re: hak_tinymce WYSIWYG article editor

I’ve hundreds of images uploaded, when i want to insert image through hak_tinymce editor on my article, there will show just image thumbnails and that’s very hard to find a specific image which I need.
I need to display image name with each mage on hak_tinymce editor plugin, then easily i can press Ctr+F to find ;-)

Offline

#1178 2016-05-26 15:17:53

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: hak_tinymce WYSIWYG article editor

raminrahimi wrote #299288:

I need to display image name with each mage on hak_tinymce editor plugin, then easily i can press Ctr+F to find ;-)

Image name, i.e. e.g. 225.jpg? Or do you mean “image name on upload”? I could offer a hack for one of caption/alt text/225.jpg.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#1179 2016-05-26 17:29:10

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: hak_tinymce WYSIWYG article editor

While enjoying the sunny weather on the balcony I had the idea you could copy over image names to alt or caption field via SQL Not necessary, see next post.

Skip that, not required ---UPDATE txp_image SET alt = name;---

Or use caption instead of alt. As always: Make a DB backup before altering the DB.

Open the plugin code and search for

$out[] = '<div class="image '.$selected.'">

That should be at/around line 659. Go to the the very end of that line where it says </div>. Immediately before that tag add the following:

<span class="YOUR_CLASSNAME">'.$caption.'</span>

If you want alt instead shown in the image selector or id use that inside the span. Style to your heart’s desire cause it’ll of course break the grid.

Last edited by uli (2016-05-27 12:51:56)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#1180 2016-05-26 17:37:44

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: hak_tinymce WYSIWYG article editor

D’oh, $name is accessible though it’s nowhere in the plugin code.

<span class="YOUR_CLASSNAME">'.$name.'</span>

No SQL-ing around, no DB backup, pristine image name like on upload! :)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#1181 2016-05-26 18:30:30

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 276

Re: hak_tinymce WYSIWYG article editor

Hi uli, thank you for support :-)

I tried the last one works fine but, My each image has two three lines caption, because of that i need to display the image name (world.jpg, cofee.jpg, love.jpg).

Note: i’ve a plugin (fh-article-image-selector) that list all the image names for article_image field, i need such image name with each image to hak_tinymce

Offline

#1182 2016-05-26 18:53:54

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: hak_tinymce WYSIWYG article editor

raminrahimi wrote #299306:

because of that i need to display the image name (world.jpg, cofee.jpg, love.jpg).

Doesn’t this code here do exactly that for you? Here its does so :)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#1183 2016-05-26 18:55:38

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: hak_tinymce WYSIWYG article editor

raminrahimi wrote #299306:

Note: i’ve a plugin (fh-article-image-selector) that list all the image names for article_image field, i need such image name with each image to hak_tinymce

Not entirely clear what you mean. Can you post a screen shot please?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#1184 2016-05-26 19:03:26

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 276

Re: hak_tinymce WYSIWYG article editor

Yes ! that’s great now my problem solved :-)
Thank you !

uli wrote #299308:

Not entirely clear what you mean. Can you post a screen shot please?

Ahu don’t worry about that ;-) that was a reference, that’s a plugin which list the image names easily we can select for each article.

Offline

#1185 2016-05-26 19:32:55

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: hak_tinymce WYSIWYG article editor

raminrahimi wrote #299309:

Yes ! that’s great now my problem solved :-)
Thank you !

You’re welcome.

I’ll transfer these posts to the hak_tinyMCE topic, some time soon, BTW.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#1186 2016-08-30 00:58:47

RinceWND
New Member
From: Russia, Vladivostok
Registered: 2016-08-30
Posts: 2

Re: hak_tinymce WYSIWYG article editor

Hi everyone!

I’m sorry if the answer to my question is somewhere on the forums already, but I never had enough diligence to search through every possible query combination.

The question is `Is this plugin compatible with beta2, because I can’t seem to install it` since it throws an error when I’m pressing `Install` button at the plugin’s prefs page:

Warning "mysql_get_server_info(): Access denied for user 'username'@'localhost' (using password: NO)".

where <username> is not the correct username that is defined in config.php, and then

Warning "mysql_get_server_info(): A link to the server could not be established".

and

User_Error "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 5".

I guess the plugin doesn’t receive a valid connection so it tries to establish new one with default server arguments that are no good for this particular textpattern installation. Is it compatibility issue or just my configuration?

In case this info matters:
PHP: 5.6.23;
MySQL: 5.5.49-cll-lve.

Offline

#1187 2016-09-09 11:47:23

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

Re: hak_tinymce WYSIWYG article editor

RinceWND wrote #300865:

Is it compatibility issue or just my configuration?

Hello, welcome to the forum. We have switched to mysqli functions in 4.6, so this could be a compatibility issue. Try to replace $mysqlversion = mysql_get_server_info(); in the plugins code with

global $DB;
$mysqlversion = mysqli_get_server_info($DB->link);

Offline

#1188 2016-09-10 06:54:13

RinceWND
New Member
From: Russia, Vladivostok
Registered: 2016-08-30
Posts: 2

Re: hak_tinymce WYSIWYG article editor

Thank you for your suggestion!

It worked and the plugin connected to my database. However it now throws this in my face:

User_Error "Specified key was too long; max key length is 1000 bytes".

Another mysql -> mysqli issue, maybe? But I don’t see any more `mysql_` function calls in the code. Or is something wrong with my db charset? (I have just tried switching db collation and dbcharset value in config.php form ‘utf8mb4’ to ‘utf8’ to no avail.)

If I get this right, the execution is now stuck on this line:

$hak_tinymce_prefs_table = safe_query("CREATE TABLE `".PFX."txp_hak_tinymce` (
	`pref_name` VARCHAR(255) NOT NULL,
	`pref_value` TEXT NOT NULL,
	PRIMARY KEY (`pref_name`)
) $tabletype");

since it doesn’t create `txp_hak_tinymce` table.
Can the `VARCHAR (255)` be a culprit here? I’m not sure, but if a single character allocates 4 bytes, this can potentially exceed the limit, as 4*255 = 1020.

I reckon that I should better set up a local server to try to debug all the errors this plugin has to show me, though I’m not good in php or sql.

———- UPD:

Yup, that’s it. Changing 255 to 250 let me finally see the preferences page. The only concern that’s left is if this change has any downsides apart from having to have shorter `pref_name`s (which are pretty much shorter, I assume).

Thank you, again!

P.S. Trying to understand how use `modern` theme of the latest version of timymce with this bundled one. Looks like tinymce changed a lot…

Last edited by RinceWND (2016-09-10 12:58:58)

Offline

Board footer

Powered by FluxBB