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

Reply
 
Thread Tools Display Modes
  #1  
Old 04-28-2011, 09:25 PM
Disasterpiece's Avatar
Disasterpiece Disasterpiece is offline
 
Join Date: Apr 2007
Location: GER
Posts: 765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Images in attachment.php: not completely loaded

Hey

I'm working on a little modification which hooks into attachment.php "attachment_display", takes the $attachmentinfo array, loads the picture files and adds some text overlay, then saves them to disk for caching purpose, then it displays them in the browser.

Right now, everything seems to work nicely, the image gets fetched, from db or filesystem depending on settings, the text gets applied properly and the cache file is created or read if it exists.

But then there's a slight problem:

When I view the image the attachment.php returns, the last 70 pixels or so get cut off at the bottom.
The cached image file is complete -> The image processing by my script works fine!
I tested the plugin code in a separat php file, let the script display the image, it works fine!

Because the attachment.php uses some weird partial stuff where it might print the image in chunks, I set $startbyte and $lastbyte to 0, so the if-clause would not run, where the vb-intern echo functions are located.
This is that the attachment.php file won't print the image, insted my plugin does.

Later on I even added an "exit()" statement at the end of my plugin, so the code after the "attachment_display" hook won't execute. Again, image was only partial in my browser.

I also tried removing the headers, maybe there is some header thing which still triggers the partial transfer.
So I added:
PHP Code:
header_remove(); 
at the top of my plugin, but instead anything, I get a broken image. I checked with liveHTTPHeaders what changed, nothing really changed, I received the same headers like when the header_remove statement wasn't there.

When I disable my plugin, the picture is complete, but without text.

To give you a better idea, here are two screenshots; left with plugin turned on, right with plugin turned off
Attachment 128619 Attachment 128618
It's blue because I selected it with my mouse, so you can see the actual borders of the image file and the space which is free at the bottom.

I'd like not to post much sourcecode, it basically does what I already described, the problem seems to be caused by vbulletin and some weird thing in the attachment.php I didn't find yet.

Please, if you have any ideas, let me know! Don't know where else to ask

//edit:

Just noticed: The thumbs in my album view aren't fully loaded as well. Check attachment #3
I only viewed the 2 middle pictures with the plugin turned on at least 1 time.
I seem to have forgotten to opt-out if the thumb param is set in $_GET, but this is an interesting detail; Because not only didn't it completely draw the image, it also didn't draw the box with the image info around the thumb. This is weird...

Attachment 128620
Reply With Quote
  #2  
Old 04-28-2011, 09:57 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is it possible that your processing is changing the file size but you're not changing $attachmentinfo['filesize'], so it's just not sending all the data (it only sends the original number of bytes)? ETA: I mean the size stored in the filedata table.
Reply With Quote
  #3  
Old 04-29-2011, 11:26 AM
Disasterpiece's Avatar
Disasterpiece Disasterpiece is offline
 
Join Date: Apr 2007
Location: GER
Posts: 765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

omg it worked!!! Thank you so much you saved my day!
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 04:54 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.06459 seconds
  • Memory Usage 2,196KB
  • Queries Executed 12 (?)
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_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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_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