Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2010-06-05 18:28:18

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: bot_image_upload: upload, sort, edit, show images in ‘write' tab

masa wrote:

I’ve been playing around with this interesting plugin, but I’m having problems under Txp 4.0.8:  the Choose image link doesn’t trigger anything when clicked. (All seems to work fine under 4.2.0.)
Suspecting a conflict I turned off all other plugins, but still nothing – any ideas?

Mhm… The only thing I could think is that maybe you have a jquery version pre 1.3.2. Is it the case?

Last edited by redbot (2010-06-05 18:28:37)

Offline

#26 2010-06-05 18:51:18

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: bot_image_upload: upload, sort, edit, show images in ‘write' tab

redbot wrote:

That’s ok. But – I’m asking again for learning purpose – do you think it is possible to perform SQL injections if you are not logged in to txp?

No, but it will just cause errors if author uses character that should be escaped. Plugins are loaded after login check process, thus bot_image_upload isn’t active at that point. But the code is still loaded on public side, because the plugin is set to be admin/public. But that’s not an issue if the code is all good. That’s also partly why I removed the globals as they were active on public side.

One last thing. I like your way of embedding images and I’m sure this will come very handy once I learn some more but in this case I’m more inclined to avoid this, so that one can easily replace the default icons. Or I’m missing something again?

In that case you could add if file_exist() check so you don’t have to bundle the images with zip along the plugin. Makes the installation much easier, tho sacrifices bit space, memory and performance.

if(file_exist( $img_path. '/bot_image_delete.gif'))
	$uri = ihu . '/bot_image_delete.gif'; /* note 'ihu' is just example. Tho, it's in the current development build */
else 
	$uri = hu . '/?bot_image_img=delete';

If you are going to support only the latest browsers (no IE7 etc) you could also embed the images in the CSS. CSS supports base64 encoded data URI scheme.

That’s all. Thank you again Jukka, you really taught me something useful!

No problem :-) Happy to contribute.

Last edited by Gocom (2010-06-05 18:53:13)

Offline

#27 2010-06-05 22:14:46

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: bot_image_upload: upload, sort, edit, show images in ‘write' tab

redbot wrote:

Mhm… The only thing I could think is that maybe you have a jquery version pre 1.3.2. Is it the case?

Perfect, all working now – thank you very much!

I had 1.2.6 since I tend to leave things as they were originally installed.

Offline

#28 2010-06-30 18:01:52

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Re: bot_image_upload: upload, sort, edit, show images in ‘write' tab

Another great plugin! thank you =)

I made some changes to it:
1. removed the loading after each click because it was not letting me to use the features of “ebl-image-edit” plugin.
(// avoid FOUC when clicking links and submits)
when I was clicking on each link of EBL it was showing the loading image and when after it disappear nothing was happen.

2. I moved the checkbox to the left side right before the ID# and changed it to radio-button.
and I unhide the regular checkbox on the right for it letting the users to delete/change things.

3. It is really cool that you can manipulate iframes :)
but I don’t think it’s good to hide something really important as the top message, so for me I unhide it.
In Remora the message does comes with a fade background on top of it (dropshadow) so you can just disable it.
iframe.find("#messagepane").css({"background-image": "none"});

4. Remove the “Add” text near each checkbox and move it to it’s own title on top
iframe.find("#list th:nth-child(9)").after("<th>$bot_add_image_text</th>");

5. “fpx_image_import” plugin creates a table with the id of “list”,
so you need to change each “#list” into “#list:first”.
yes I know it’s have nothing to do with your plugin and:
a. it’ an old plugin.
b. it’s wrong to use the same id for 2 elements.
but it will be easier to change your plugin for others who may use that old plugin.

EDIT: and this change did helped me too.

Last edited by THE BLUE DRAGON (2010-06-30 18:05:23)

Offline

#29 2010-06-30 19:16:06

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: bot_image_upload: upload, sort, edit, show images in ‘write' tab

Hi,
before answering your post let me say that this plugin its just a proof of concept in its current state.
I’m planning to release version 2 for weeks but really can’t find the time, though in my development copy I think I’ve fixed all issues found till now (and cleaned code a lot – thanks to Jukka’s help).
Here are my thoughts:

Another great plugin! thank you =)

Thanks!

1. removed the loading after each click because it was not letting me to use the features of “ebl-image-edit” plugin.
(// avoid FOUC when clicking links and submits)
when I was clicking on each link of EBL it was showing the loading image and when after it disappear nothing was happen.

Compatibility with other image plugins is one of the major issues. I still have to investigate this.

2. I moved the checkbox to the left side right before the ID# and changed it to radio-button.
and I unhide the regular checkbox on the right for it letting the users to delete/change things.

This is ok. I highly encourage plugins customization depending on specific site needs (and I won’t create a preferences page – it isn’t worth the effort).
Remember to unhide iframe.find("#withselected").parent().hide(); too!

3. … In Remora the message does comes with a fade background on top of it (dropshadow) so you can just disable it.

I have already fixed remora compatibility issues in v. 2 (hiding #messagepane completely)

I hope to release it shortly but I realize I’m not too reliable these days.

Last edited by redbot (2010-07-02 14:33:55)

Offline

#30 2010-07-04 18:28:11

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: bot_image_upload: upload, sort, edit, show images in ‘write' tab

Version 0.3 is out.
It should fix all bugs found til now and, thanks to the help of Jukka, the code is now a lot more cleaner and elegant.
Also, images are embedded directly in the plugin (though you can still change them modifying the plugins css)
The only thing which is still lacking is multiple image management because I’m still unsure I want to add this functionality.
The fact is this would involve more js to load and more issues to solve. Just think to where thumbnails should be placed, given that there could be one or one hundred.
I know a comma separated list of image ids is a common setting but – when I need a gallery – I rather prefer to use an ad hoc custom field instead of the article image field. However I’ll see if in a remote future I’ll add this.

Changelog:

Jukka:
  • Fixed SQL injections.
  • Moved CSS to stylesheets.
  • Moved Javascript, and CSS, into head section.
  • Embedded images to the plugin’s PHP (base64_encoded).
  • Removed escaping from the JavaScript.
  • Checks if the image has thumbnail. If not, shows the full sized image.
me:
  • Fixed ‘login in iframe’ issue
  • Fixed issue when ‘author’ column is missing
  • Fixed thumbnail issue when logged as “Staff Writer”
  • Usability improvement: save button is now removed from iframe and placed in a more convenient place
  • Compatible with ebl-image-edit
  • jbx_multiple_image_upload its hidden in the plugin’s interface (but continues to work normally in the ‘images’ tab) – multiple upload doesen’t make sense untill the plugin works for single images.
  • Fixed ie issues with checkboxes
  • A few visual tweaks

Gocom
Thanks again for the help. I incorporated almost all your code with the exception of the multiple-image part as I explained before.
Also, I changed a little your coding style in a more familiar way for me (Just minor things like curly brackets for ‘if’ statements).
A last thing, some posts before I said some changes you suggested weren’t working. Well not really, there were only some small typos.
Ah, anoter last thing ;-) I moved the call to bot_image_img() inside if(txpinterface == 'admin') and changed links in css accordingly.
I think that’s because you were thinking this was an admin+client plugin while it actually is admin only.

aswihart/sacripant/THE BLUE DRAGON
Thanks for the suggestions. some of which I’ve adopted.
As for the ‘radio vs checkbox’ issue I decided to keep the checkboxes (of course you are encouraged to change it if you prefer).
That’s because it is true that radios are more semantical but in this case I think checkboxes increase usability: an average user wants the ability to check and uncheck an image at his will, and this isn’t possible with radios where at least one item must be checked.
I did not found the time to check for fpx_image_import compatibility (I prefer jbx_multiple_image_upload these days), anyway it seems you have already found and posted a working solution so I won’t consider it a priority.

Download from first post.

Last edited by redbot (2012-01-04 18:58:52)

Offline

#31 2010-07-05 01:21:58

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: bot_image_upload: upload, sort, edit, show images in ‘write' tab

redbot wrote:

Thanks again for the help.

No problem :-)

I think that’s because you were thinking this was an admin+client plugin while it actually is admin only.

No, I really didn’t. I did it because it doesn’t matter, and that nothing gets output before the plugin call.

As far the txpinterface call, if you set your plugin type to Admin only (3), you need the conditional block and the plugin won’t be loaded on the frontend. Admin only plugin’s were introduced in TXP 4.0.7.

Offline

#32 2010-07-05 08:48:56

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: bot_image_upload: upload, sort, edit, show images in ‘write' tab

redbot wrote:

… I moved the call to bot_image_img() inside if(txpinterface == 'admin') and changed links in css accordingly.
I think that’s because you were thinking this was an admin+client plugin while it actually is admin only.

Gocom wrote:

…No, I really didn’t. I did it because it doesn’t matter, and that nothing gets output before the plugin call.

Ok sorry I wasn’t clear at all. I just wanted to point out that I had to change all images path in the css you suggested from:

background: url("'.hu.'?bot_image_img=delete") top center no-repeat;

to:

background: url("'.hu.'textpattern?bot_image_img=delete") top center no-repeat;

because – still I don’t understand why – the former doesn’t work.

Offline

#33 2010-09-11 01:41:04

jelle
Member
Registered: 2006-06-07
Posts: 165

Re: bot_image_upload: upload, sort, edit, show images in ‘write' tab

Great plugin…any chance for multiple image support anytime soon?

Offline

#34 2010-09-11 12:19:32

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: bot_image_upload: upload, sort, edit, show images in ‘write' tab

jelle wrote:

Great plugin…any chance for multiple image support anytime soon?

Hi jelle,
I think sooner or later I’ll need to add this functionality for some project.
The problem is that, while it is relatively easy to do for a specific site it must be planned very well to become a more generic plugin.
There are a lot of variables too keep into account (use a custom field or the “article image” field? how and where to display thumbnails – there is a big difference between displaying two thumbnails or 50? etc).
Other than that I’m just too busy with other issues these days so I’m not very focused on plugins.
Anyway – I’m making no promises here – I think I’ll try to do it when I’ll find some free time and motivation, ok?

Last edited by redbot (2010-09-11 12:20:07)

Offline

#35 2010-09-12 14:58:16

jelle
Member
Registered: 2006-06-07
Posts: 165

Re: bot_image_upload: upload, sort, edit, show images in ‘write' tab

hi rb,

thanks for your answers. I do understand the issues that arise when making such a plugin. personally I don’t like how images and files are handled on the backend. Your bot_image_upload and bot_file_upload a great but still not exactly what I want. I’m hacking my way with bot_file_upload to have it integrated into the write page instead of a pop-up. Looking for the same for images. Maybe I’ll just dive into the code bot_image_upload and see what I can come up with.

redbot wrote:

There are a lot of variables too keep into account (use a custom field or the “article image” field?

hm, I think I’d stick to using an the article image field for compability with other plugins (hak_article_image for example) or when the bot_image_upload itself is removed/disabled.

thanks again.

Offline

#36 2010-11-15 12:09:18

jens31
Plugin Author
From: munich / dtschermani
Registered: 2008-08-25
Posts: 183
Website

Re: bot_image_upload: upload, sort, edit, show images in ‘write' tab

yup. sounds like a very kool plug-in.
and same with me, i also want the support for multiple images..
in fact i landed here because i want to show all (like 50..) article images in the write tab..

i do understand the motivation thing, so what do you want from us..? name your price ;)

Offline

Board footer

Powered by FluxBB