Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-28-2013, 03:30 PM
KaitenV's Avatar
KaitenV KaitenV is offline
 
Join Date: Apr 2009
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default php parse attachments, parsing bbcode works

I have this code to parse the bbcode into html, and it works perfectly, except attached images are made into links. How can I get the bbcode parser to make the images display with the <img /> tag and not links?

PHP Code:
$forumpath SRD."forums"// path to your forum
    //echo $forumpath;
    
$that_cwd = @getcwd(); // absolute path to this script
    
chdir($forumpath);
    
$phrasegroups = array();
    
$globaltemplates = array();
    
$actiontemplates = array();
    
$specialtemplates = array();
    require_once(
'./global.php');
    require_once(
'./includes/class_bbcode.php'); 
    @
chdir($that_cwd);
    
$bbcode_parser =& new vB_BbCodeParser($vbulletinfetch_tag_list(), true);  
    
//$my_text = $bbcode_parser->do_parse("[b]Parse[/b]",false,true,true,true,true,false);
    //echo $my_text; 
Reply With Quote
  #2  
Old 06-28-2013, 04:59 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In Settings > Options > Message Attachment Options, what do you have selected for "View Attached Images Inline" and "Thumbnail Creation"?
Reply With Quote
  #3  
Old 06-28-2013, 06:29 PM
KaitenV's Avatar
KaitenV KaitenV is offline
 
Join Date: Apr 2009
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

"View Attached Images Inline" is set to "Yes, full size" - when it was set to "Yes, display thumbnails" only a link was displayed as well.
"Thumbnail Creation" is set to "Yes"

When I go to: Maintenance -> General Update Tools -> Rebuild Attachment Thumbnails
Code:
Building Attachment ThumbnailsIf you receive a fatal error or if the process seems to hang, you will need to delete the last attachment listed on the screen then refresh this window.
Processing: Attachment : 1 (jpg) Error
Processing: Attachment : 2 (jpg) Error
Processing: Attachment : 3 (jpg) Error
Processing: Attachment : 4 (jpg) Error
Processing: Attachment : 5 (jpg) Error
Processing: Attachment : 6 (jpg) Error
Processing: Attachment : 7 (jpg) Error
Processing: Attachment : 8 (jpg) Error
Processing: Attachment : 9 (jpg) Error
Processing: Attachment : 10 (jpg) Error
Processing: Attachment : 11 (jpg) Error
Processing: Attachment : 12 (jpg) Error
Processing: Attachment : 13 (jpg) Error
Processing: Attachment : 14 (jpg) Error
Processing: Attachment : 18 (jpg) Error
Processing: Attachment : 19 (jpg) Error
Processing: Attachment : 20 (jpg) Error
Processing: Attachment : 21 (jpg) Error
Processing: Attachment : 23 (jpg) Error
Processing: Attachment : 24 (jpg) Error
Processing: Attachment : 25 (jpg) Error
Processing: Attachment : 28 (jpg) Error
Processing: Attachment : 29 (jpg) Error
Processing: Attachment : 30 (jpg) Error
Processing: Attachment : 31 (jpg) Error
Reply With Quote
  #4  
Old 06-28-2013, 10:02 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK. I don't know if that's a problem or not, I was just looking at the parsing code and noticed that it doesn't try to show the images unless those settings allow it (and the way you have them set is OK).

Oh, I should have asked: what does your call to $bbcode_parser->parse() look like? The code you posted has a commented out call to do_parse().
Reply With Quote
  #5  
Old 06-29-2013, 12:56 AM
KaitenV's Avatar
KaitenV KaitenV is offline
 
Join Date: Apr 2009
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not using $bbcode_parser->parse(); I am using this:
PHP Code:
$News['pagetext'] = $GLOBALS['bbcode_parser']->do_parse(unhtmlspecialchars($News['pagetext']),false,true,true,true,true,false); 
If I should be using $bbcode_parser->parse(); please give an example.
Reply With Quote
  #6  
Old 06-29-2013, 09:29 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, that's OK, you can call do_parse(). I just assumed (incorrectly) that the commented out call to do_parse() was an experiment or something.

I'm not sure what the problem is, I'd probably have to have it set up so I could debug it. I guess it could be the errors you're getting when you try to build the thumbnails. Do you have the image processing options set up correctly? Does it work for normal forum posts?
Reply With Quote
  #7  
Old 06-29-2013, 12:14 PM
KaitenV's Avatar
KaitenV KaitenV is offline
 
Join Date: Apr 2009
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where are the image processing functions? On normal form posts the thumbnails don't work, but I have it set up so full size images do work (http://otakuhelpers.com:8080/forums/...ter-535-Review!), if I try to use thumbnails it only displays a link.
Reply With Quote
  #8  
Old 06-29-2013, 05:52 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I meant the options under Settings > Options > Image Settings.

I'm guessing it has something to do with the missing thumbnail images, but I can't follow all the logic (I'm looking at handle_bbcode_img() in includes/class_bbcode.php).
Reply With Quote
  #9  
Old 06-29-2013, 06:49 PM
KaitenV's Avatar
KaitenV KaitenV is offline
 
Join Date: Apr 2009
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have Image Processing Library > GD is checked. That is all that is installed.
Reply With Quote
  #10  
Old 06-29-2013, 07:32 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, that sounds good. I'm looking at the "rebuild attachments" code to see what could cause errors. Do you have attachments stored in the database or the file system? If you have them stored in the database, you need a valid writable temp path, either in the php settings, or possibly in the vb settings if you are using open basedir restrictions (although I think if you didn't have a writable temp path you wouldn't be able to upload anything).

If you have attachments stored in the file system, those directories have to be writable (but again, if they weren't you wouldn't be able to attach anything).

I guess if you've been using the same server for a long time but just upgraded vb, then it's probably not the directory permissions (unless maybe you moved them).
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 02:30 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04674 seconds
  • Memory Usage 2,256KB
  • 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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete