Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-09-2007, 05:42 PM
jamesmarch jamesmarch is offline
 
Join Date: Mar 2007
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Image Hosting Feature

Hello,

I have written a flash utility sits next to the editor box like smiles and lets you upload images to ImageShack.us and automatically inserts the generated thumbnail into the editor.

I need a little help integrating it into all the different types of editor modes vbulletin might use.

Here is a rundown of what I have so far. (Please keep in mind these code samples are only to help explain my integration with vbulletin)

Here is the swf object embed code.
HTML Code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  id="uploader"
  width="280"
  height="90"
  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
  <param name="movie" value="http://profile1.imageshack.us/jmarch/multiploader.swf" />
  <param name="quality" value="high" />
  <param name="allowScriptAccess" value="always" />
<embed
  src="http://profile1.imageshack.us/jmarch/multiploader.swf"
  quality="high"
  bgcolor="#ccc"
  name="uploader"
  type="application/x-shockwave-flash"
  pluginspage="http://www.macromedia.com/go/getflashplayer"
  flashvars="maxAllowedFileSize=13145728&callback=addImg2TextArea"
  AllowScriptAccess="always"
  align="middle"
  height="90"
  width="280">
</embed>
</object>
Here is the javascript.
Code:
function addImg2TextArea(imageData)
{
 var imageThumb;
 if (imageData.hasThumb) {
   imageThumb = "<a href='http://img" + imageData.imageServer + ".imageshack.us/my.php?image=" + imageData.imageName + "'><img src='http://img" + imageData.imageServer + ".imageshack.us/img" + imageData.imageServer + "/" + imageData.hashBucket + "/" + imageData.thumbName + "'></a>";
 }
vB_Editor['$editorid'].editdoc.body.innerHTML += imageThumb;


Example screenshot.


I put the Javascript function addImg2TextArea in the top of the editor_toolbar_on template
and i put the swf embed code in the editor_toolbar_on template somewhere around the editor box..

This is not a complete piece of work, but I think it is to a point where people can understand where I am trying to go with the project and offer constructive feedback to help improve the application.

How it works.

You select an image, and press upload, the image is sent to an imageshack server, once the image upload is complete, a user specified callback function fires that is passed an object that contains the name of the image and of the web server and the folder the image resides in.

imageData.hasThumb // Only images over specific resolution have thumbnail's generated
imageData.imageServer // Server number where image was uploaded
imageData.hashBucket // Folder on the server where image sits
imageData.thumbName // name of the file for the image thumbnail
imageData.imageName // name of the full sized image you uploaded on to server.

So as this is now, it seems to work, but only if you are logged in as admin.
Something changes with the wysiwyg editor mode when you switch from admin to normal user, and I am still trying to figure that out.

Any advice would be very welcome.

Some questions I have:
1. Would this be better written as a plugin/product?
2. Is there a better way to inject data into the editor?
3. Other ideal feature requests before we release this?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:36 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03435 seconds
  • Memory Usage 2,170KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete