The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Retrieve and display attachments from database
I'm trying to retrieve the 10 most recent attachments on an outside page. My attachments are in files. This is what I've come up with so far, but I don't know what the path is to the images and how to display them. Any suggestions?
<?php $result = mysql_query("SELECT * FROM attachment ORDER BY dateline DESC LIMIT 0,10", $connection); if (!$result) { die("Database query failed: " . mysql_error()); } while ($row = mysql_fetch_array($result)) { echo "<img src=\"/attachmentpath/" . $row[4] . "/><br />"; } ?> |
#2
|
||||
|
||||
The attachment table will define the type of attachment.
The actual attachments live in baseaddress/attachments/u/s/r/i/d/attachmentid.attach The user ID is broken into individual digits as directories, so if you have userid 603 and an attachment id of 500 then it will live in attachments/6/0/3/500.attach There is also an attendant 500.thumb |
#3
|
|||
|
|||
Thanks, so I have the path, but how do you display .attach?
|
#4
|
||||
|
||||
".attach" is just a temporary extension. The content of this ".attach" file is the actual file.
|
#5
|
||||
|
||||
Query the attachment table to see what kind of file it actually is, and then convince php to handle the file correctly. This may involve moving the file to /tmp with the appropriate suffix, or...well...something else. php/file system interactions are not my forte.
|
#6
|
||||
|
||||
Basically, you just need to send the correct headers to the browser.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|