1 (edited by Quadric 2012-02-19 09:21)

Topic: [Extension] Image Assistant (quadric_image_assistant)

Standard pun_attachment connect files on the end of the post.
Fancy extensions use external servers to handle image uploads.
Hcs extension upload image and connect to a post and drop when not in post.

I want a simple but effective image uploader for PunBB which stores images and let them use whenever you need but i couldn't find an appropriate extension. So i wrote such thing myself:

This extension allows user to upload images or use already uploaded image when writing a post and put it into a message as img or url tag. Images may be used many times in many posts or wherever you want. Images are never deleted automaticly.

1) Upload images when writing post (plupload)
2) Insert as img or url
3) Images are connected to user so they can be used in many posts
4) Browse already uploaded images
5) Delete images
6) Image preview (fancybox)
7) Polish and English translation
8) Admin configuration

1) pun_jquery
2) pun_bbcode

RCT Forum
(For the effect. If you want to upload image you have to be authenticated)

Quadric Image Assistant 1.0.0 RC1
Quadric Image Assistant 1.0.1
Quadric Image Assistant 1.0.2
Quadric Image Assistant 1.1.0 (not compatible with 1.0.x) (How to upgrade?)
Quadric Image Assistant 1.1.1
Quadric Image Assistant 1.1.2
Quadric Image Assistant 1.1.3
Quadric Image Assistant 1.1.4
Quadric Image Assistant 1.1.5

It uses fancybox (2.0.4) and plupload (

15 Feb 2012, v1.1.5

- Core:
  . Compatibility for PunBB 1.4.2

12 Jan 2012, v1.1.4

- Core
  . Fixed transaction commit for sqlite
  . Fixed delete security - basename on file

12 Jan 2012, v1.1.3

- Core
  . Fixed bug for root fixed misc.php functions controller

- Plupload:
  . Upgrade to 1.5.2
  . Fixes in upload.php from old examples

10 Jan 2012, v1.1.2

- Core:
  . Fixed bug truncating /t in full string (found by fu86)

04 Jan 2012, v1.1.1

- Core:
  . Fixed dir permission to use 0775

04 Jan 2012, v1.1.0

- Core:
  . Code optimizations (reuse some code from pun_attachment)
  . Upload code improvement (faster upload)
  . Changed upload dir from ext_path to root_path (shorter path)
  . Database backend
  . Image browser use database to show user images
  . Fixed image browser max height
  . 0.8 Opacity action icons

- Plupload
  . Changed html5 be before flash. Html5 is better (but msie use flash engine)
  . Fixed button not being hovered (still not hovered when flash engine)

31 Dec 2011, v1.0.2

- Admin:
  . Fixed breadcrumbs

30 Dec 2011, v1.0.1

- Core:
  . Code cleanup
  . Fixed button align
  . Fixed fancybox links request (see them as a group)

- Plupload:
  . Update to

26 Dec 2011, v1.0.0 RC1

- Core:
  . First Release

This is my first such big extension for PunBB so please if you try it and find some bugs or suggestions feel free to tell me and i'll try as soon as possible to fix it. Please consider this extensions as RC1 version.

This extension use some parts from HCS image uploader extension

Warning: This extension depends on pun_attachment also but i may create create independant version

Re: [Extension] Image Assistant (quadric_image_assistant)

big_smile very nice! great job, definitely working

1. is it possible to align "images" text with the buttons?


2. when searching for the file to upload I get "browser page unresponsive" messages if searching for 10-20 seconds though a folder.... is this the browser, or a setting in the extension?

3.  upload button looks as below from time to time in Chromium 15.0.874.106 (Developer-Build 107270 Linux) Ubuntu 10.04 (just as an FYI)


PS: This is very neat: smile


Re: [Extension] Image Assistant (quadric_image_assistant)

Hi KeyDog. Thanks for your feedback.
According to your questions:
1) I'll try to fix it ASAP
2) So you click "upload images" and when browsing 10-20 seconds your browser get unresponsive? What browser and what OS do you have? And what version of flash (if any)
3) This is very strange. I'm affraid that's a plupload problem/bug but i'll try to find some info about that - maybe i've made sth wrong.

About your last comment:
I think about split images into a groups of upload dates... so it should like

28 December 2011
[__] [__] [__]

27 December 2011
[__] [__]

26 December 2011
[__] [__] [__] [__]

What do you think about that?

Re: [Extension] Image Assistant (quadric_image_assistant)

- Chromium 15.x on ubuntu 10.04 , Adobe Flash-Plugin... 
- just tried it on XP machine - it all works fast and without any problem there

- maybe it's just due to 2) - haven't had the issue on XP

Split images; sounds like a good idea!


Re: [Extension] Image Assistant (quadric_image_assistant)

Hi Quadric. Good job. I have 3 comments.

  • The galleries of images dysfunctional, the images are placed randomly. Will look like the window, if the user has for example 200 images?

  • If you delete a picture in the gallery, it will not be removed from the message, and will display "no image"

  • The code of extensions built on my extension, in the sections of the copyright of this there are no references. sad For example look how contains links to the original sources in my version of the file upload.php

 * Add upload image form for posting with images
 *    hcs_image_uploader
 * @copyright (C) 2010 hcs hcs@mail.ru
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 *    Extension for PunBB (C) 2008-2009 PunBB
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 *  Based on code upload.php Copyright 2009, Moxiecode Systems AB
 *  Released under GPL License.
 *  License: http://www.plupload.com/license
 *  Contributing: http://www.plupload.com/contributing  

6 (edited by Quadric 2011-12-27 15:32)

Re: [Extension] Image Assistant (quadric_image_assistant)

2) I'll check it out

1) That's why i've proposed splitting it into a dates. I think it should make it cleaner.

2) You're right. But how would you prevent such situation? Check if there a post with a picture included? Or maybe drop delete image functionality from common user?

3) Yes, this is my first extension and it's inspired by your extension - it is closest to what i've want to achieve that's why i used it as my base (becouse i didn't even know how to write extensions). At first i want to make such extension for myself but it works nice so i want to share it. I've used some parts of your code but to be honest i thought that you've got uploading parts from the plupload examples 1:1 so i'm sorry for this situation.

OK. Reinventing the whell is not the best solution because some parts of code used here are very common tasks. I didn't change anything in upload.php code so i'll fix this header to contains you oryginal copyright info and any other script that i've based on it i'll add info that is based on your extension, OK? Again sorry for this situation. I didn't want to steal or use you work without permission i just want to make it fast for my own purpose. Most of the code will be rewritten in the final release.

And thanks for your feedback. I hope you're not discouraged of this situation. I'd like to make this extension as good as possible.


Re: [Extension] Image Assistant (quadric_image_assistant)

Ok, no problem.

2) Keeping track of all posts, where there is the image, without storing information in the DB is not possible. Therefore I did as there is now in my extension. This option is you do not like smile

8 (edited by Quadric 2011-12-27 19:22)

Re: [Extension] Image Assistant (quadric_image_assistant)

Before RC2 release i'd like to make sure if this is OK

 * Upload image or use already uploaded and put into a post as bbcode tag
 * Extension for PunBB 1.4
 * quadric_image_assistant
 * @copyright (C) 2011 quadric quadmachine@wp.pl
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 * Extension for PunBB (C) 2011 PunBB
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 * Based on code hcs_image_uploader Copyright (C) 2010 hcs hcs@mail.ru
 * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 * Based on code upload.php Copyright 2011, Moxiecode Systems AB
 * Released under GPL License.
 * License: http://www.plupload.com/license
 * Contributing: http://www.plupload.com/contributing  

Re: [Extension] Image Assistant (quadric_image_assistant)

I think it's definitely okay.
I also think it makes a lot of sense to improve others extensions and re-release them with added features.
It's in the interest of the community.
You're doing the right thing!

Re: [Extension] Image Assistant (quadric_image_assistant)

I've made version 1.0.1

1) Button align fixed
2) and 3) I've uploaded new version of uplading script. Please check if something help for your problem.

Remember to refresh browser cache!

I have fixed fancybox img file group launching method so img grouping should work.
I didn't made file browser as good as i want but i'll try to make it soon.

Re: [Extension] Image Assistant (quadric_image_assistant)

A bug.


Taiwan is a country.
I am sorry for my English.

12 (edited by Quadric 2011-12-31 10:29)

Re: [Extension] Image Assistant (quadric_image_assistant)

Hey ethan42411, thanks for your feedback.
Bug confirmed - i'll try to fix it

Now it's fixed in 1.0.2


Re: [Extension] Image Assistant (quadric_image_assistant)

Small bug;
the upload button qia-pick-files doesn't act the same as qia-browse-files.
background doesn't change color on hover (qia-pickl-files)..

Re: [Extension] Image Assistant (quadric_image_assistant)

Confirmed. The problem is that plupload cover the upload button with his own invisible container. I'll try to fix that.

Just a notice: I've made a new 1.1.0 version with database backend, core optimization and uploaded dir has changed. Now images are uploaded into ROOT "img/m" folder, so the img link doesn't look like:




which i think is much more cleaner.

And files browsing is made on database not scan dir which is better becouse it doesn't overfload server

That's why the 1.1.0 version is not compatible with 1.0.x

I'll try to upload this new version asap.


Re: [Extension] Image Assistant (quadric_image_assistant)

Quadric wrote:

Confirmed. The problem is that plupload cover the upload button with his own invisible container. I'll try to fix that.
I'll try to upload this new version asap.

Looking forward to it, this extension really shows images in a nice fashion. Thank you.

16 (edited by Quadric 2012-01-04 22:22)

Re: [Extension] Image Assistant (quadric_image_assistant)

OK, new version awaits in the first post.

Clean install
1) Just copy extension and install it. Then make your FORUM_ROOT/img/m folder writable

Upgrade from 1.0.x
1) Move contens from FORUM_ROOT/quadric_image_assistant/uploads/users/1000/* to FORUM_ROOT/img/m folder
2) Change every folder name "thumb" to only "t" letter
3) Uninstall previous version and remove plugin from disk
4) Upload new plugin and install it
5) After install the new table" qia_images" has been created. To make it work you have to fill this database for yourself but the most important column is "owner_id" and  "file_path" which should be "img/m/<owner_id">/<filename>

Re: [Extension] Image Assistant (quadric_image_assistant)

Another release. I have a bug in settings directories permission for upload structure. Now should be OK in v1.1.1


Re: [Extension] Image Assistant (quadric_image_assistant)

Great stuff.

BTW: Would this also work for uploading say mp3 files? then using the mp3 extension to let users share their music (non-copyrighted of course tongue ) ?


Re: [Extension] Image Assistant (quadric_image_assistant)

I had some "issues" with this extension on ".net"-domains.
For some weired reasons, there are some replacements for "t/" on the URL (i know to change between the thumbnails an the original). This is fatal if _all_occurences of "t/" will be removed, especially if the URL looks like this:


To fix this, you have to edit two files. Here is the diff:

diff -r quadric_image_assistant.orig/assets/uploader.js quadric_image_assistant/assets/uploader.js
<         var path = $(this).parent().find('img').attr("src").replace('t/', '');
<         PUNBB.pun_bbcode.insert_text('[url=' +  path + ']' + title, '[/url]');
>         var path = $(this).parent().find('img').attr("src").match(/(.*)\/t(.*)/);
>         PUNBB.pun_bbcode.insert_text('[url=' +  path[1]+path[2] + ']' + title, '[/url]');
< });
\ No newline at end of file
> });
diff -r quadric_image_assistant.orig/manifest.xml quadric_image_assistant/manifest.xml
>                               $url = preg_replace("/(.*)\/t(.*)/", "$1$2", $url);
<                         '<span class="postimg"><a href="'.str_replace('t/','',$url).'" class="thumb"'.$rel.'>',
>                         '<span class="postimg"><a href="'.$url.'" class="thumb"'.$rel.'>',

Re: [Extension] Image Assistant (quadric_image_assistant)

Hey fu86.

Wow, i can't believe that i've made such mistake. Thanks for the solution. I've change it a little bit  to make sure that only "/t/" is stripped.

Thanks again. New version uploaded in first post.


Re: [Extension] Image Assistant (quadric_image_assistant)


Because the * is greedy, only the last /t/ will be detected and /(.*)\/t(.*)/ worked. The first (.*) is "hungry" smile

22 (edited by Quadric 2012-01-11 19:58)

Re: [Extension] Image Assistant (quadric_image_assistant)

Yes, you're absolutely right but someone may wish to use something with last letter "t/ after the "/t/" for thumbnail, for ex:


or image id will change for something like that


I know that this extension doesn't really do anything like that but someone may use own path for some images so i thought it would be nice to secure it for that case.


Re: [Extension] Image Assistant (quadric_image_assistant)

Good point.
Thanks for the great work!

Re: [Extension] Image Assistant (quadric_image_assistant)

Thanks for everybody's feedback. I'm really happy that this extension found to be useful.

There is one thing that i think might be a lot better - image browser. Now honestly... it sucks. Do you have any suggestions, ideas how to make it better, more useful? Maybe organizing uploaded images into categories, or maybe some filters by date, maybe image browser thumbs should be bigger or smaller?

25 (edited by Intelifuel 2012-01-11 23:08)

Re: [Extension] Image Assistant (quadric_image_assistant)

Quadric - Awesome and thank you for a great extension. 
Now, please tell me how I broke it....

I'm running 1.4.1 on SQlite with the following installed extensions:

Installed extensions
Admin add user
Version 1.4.1
Created by PunBB Development Team

Version 1.1.17
Created by PunBB Development Team

BBCode buttons
Version 1.4.18
Created by PunBB Development Team

Broadcast e-mail.
Version 0.2
Created by PunBB Development Team

Fancy AddThis
Version 0.7.6
Created by dimka.linux@gmail.com

Fancy Alerts
Version 1.5.9
Created by dimka.linux@gmail.com

Fancy Category Hidder
Version 1.0.12
Created by dimka.linux@gmail.com

Fancy Favorite Topics
Version 1.6.4
Created by dimka.linux@gmail.com

Fancy Link Icons
Version 0.3
Created by dimka.linux@gmail.com

Fancy Stat Counter
Version 0.3.2
Created by dimka.linux@gmail.com

Fancy Stop SPAM
Version 1.2.3
Created by dimka.linux@gmail.com

Fancy Video Tag
Version 0.4.9
Created by dimka.linux@gmail.com

Fancy jQuery Addons
Version 2.2.2
Created by dimka.linux@gmail.com

Forum Archive
Version 0.3.9
Created by dimka.linux@gmail.com

Forum news
Version 1.1.2
Created by PunBB Development Team

Header Image ( Extension disabled )
Version 1.1.3
Created by Eliot Friedman

Post Edit Control
Version 0.6.2
Created by The HungryCoder (updated dimkalinux)

Post karma
Version 1.1.2
Created by PunBB Development Team

Private Messaging
Version 2.4
Created by PunBB Development Team

Pun tags
Version 1.5.1
Created by PunBB Development Team

Quadric AdSense Manager
Version 1.0.0
Created by Quadric

Quadric Image Assistant
Version 1.1.2
Created by Quadric

Quadric SEO Optimizer
Version 1.1.1
Created by Quadric

Version 1.1.3
Created by PunBB Development Team

Now, everything appears to work fine.  I can select, upload and use an image just like the functionality should be. 
However, if I leave that thread and go to another or back to that thread - start to post another reply or thread and click on BROWSE IMAGES - I get this:


What did I do to break your extension?
If you'd like to register at my fourm and post a test - please feel free:  Intelifuel® Alternative Energy Forums