View Full Version : Attachments to Gallery?
May 22nd, 2005, 03:32 AM
I have very attachment intensive forums (images, video) - is there some way to "import" these into the Gallery? Perhaps by attachment id or something similar?
When I first started out, there weren't really any viable forum/gallery integrated solutions, which is why I've ended up with things the way they are.
Ideally I'd like to convert my forums to be just for message threads (and in turn disable attachments) and then use the Gallery what it's designed for - image and video presentation, with the added bonus of vB integration for comments on each type.
If there isn't any current solution for this - is it something that might be considered for a future release?
May 22nd, 2005, 11:22 AM
I created this script for someone else, so you can try it and see if it works for you. First you need to create some categories in the gallery with the exact same name as the forums you want to import your attachments from. Then upload this script to your gallery directory, run it, and it should import your attachments from those forums.
May 22nd, 2005, 02:03 PM
Excellent, thanks Brian. I will give it a try shortly. Quick question....will it bring in only those attachment types defined in vBadvanced Gallery? For example, if I have a .txt, .doc, .pdf etc attachment in a vB forum, will it ignore them, if not defined in Gallery? If not, what happens with them?
Thanks again, will let you know how it works for me.
May 22nd, 2005, 02:08 PM
It should import any attachment in that forum no matter what the extension is. If you need to get rid of some afterwards though then you should be able to run a query like this:
DELETE FROM adv_gallery_images WHERE extension = 'txt';
Then after you remove any extensions you don't want in there, run the 'Scan Database' option in the maintenance section, as well as the 'Update Counters' option and that should take care of everything.
May 22nd, 2005, 02:39 PM
Excellent, thanks. Couple more questions.......does the script move or copy the attachments? In other words, do they stay in the source directory or are they moved or copied to the "gallery/files" directory? I wouldn't want duplicate files on disk, as in my case, available disk space might become an issue. I have over a gig of attachments :eek: .......and what state are the original messages left in? Is the message text left in place and the attachment removed from the thread or does the script convert the message text into a comment with the original posting's member details included in the newly created gallery posting? Also, is there any fall out with the member post counters? Or will the 'Update Counters' option take care of that? Finally, how long approximately will this whole process take? If it's a "move" I would think it would be quite quick, no matter how large my attachment totals are, right?
By the way, I store my attachments in the file system.....shouldn't be a problem, right?
Ok, no more questions, I'll try it out shortly, that will no doubt answer anything else. Thanks again.
May 22nd, 2005, 03:09 PM
It copies the files over to the gallery. If it just moved them then that would probably create a headache with the files that you don't want moved and such. I'm pretty sure vB has some options where you would easily be able to remove the attachments afterwards as well.
It shouldn't affect your posts/threads in any way.
The script has some redirects in place, so even if it does take it a little while to move all of the files you still should be able to just leave the window open while the script is doing it's thing.
May 23rd, 2005, 01:45 AM
I ran the script as per the instructions, but it appears to be transposing the directory names. For example, here's the physical path to one of the attachments in vB:
The script is failing with the following error:
Warning: copy(/forum/attachments/242/1381.attach): failed to open stream: No such file or directory in /gallery/import_attachments.php on line 81
It appears to be trying to copy the directory contents of 242 instead of 2/4/2.
Is their something in the script I can edit to correct this?
May 23rd, 2005, 09:16 AM
Find this bit of code:
$vboptions['attachpath'] . '/' . $attach['userid']
$vboptions['attachpath'] . '/' . $folderstring
And see if that helps.
May 23rd, 2005, 02:08 PM
Thanks, that fixed it. I also had to Rebuild Image Sizes and Info, as they weren't showing up initially after running the script.
June 12th, 2005, 09:07 PM
Would this import the text and title and the name of user for the post the attachment was in? Thanks!
June 13th, 2005, 08:59 AM
It imports the user info, but nothing from the thread.
June 14th, 2005, 07:45 PM
is there a way to integrate the forums upload tool with the gallery as well, only for images?
June 14th, 2005, 08:39 PM
getting this error:
Warning: copy(/path/to/your/attachment/directory//4/5/1/6/3036.attach): failed to open stream: No such file or directory in /home/site/public_html/forums/gallery/import_attachments.php on line 81
June 15th, 2005, 08:06 AM
Somehow I don't think that's a valid directory on your server...
June 15th, 2005, 10:20 AM
lol yyea....i seen this....
so what is this line mean then, im lost on it?
June 16th, 2005, 08:37 AM
Open your includes/config.php file and add $debug = 1; somewhere in that file. Then go to your Admin CP => vBulletin Options => Version Info and Other Untouchables => File Attachment Path. Make sure that option is set to the full path to your attachments folder. Then remove that line that you added to your config.php file as leaving it there could be a security risk.
June 16th, 2005, 11:43 AM
This idea seems promising. Before I break my board, are the attachments replaced with nice [ img ] images instead? Or are they removed?
Or is it purely to copy things over so you can prune old attachments without losing unique stuff?
And I too would like the VB attachments system replaced with automatic gallery uploading, it would be great if it were as quick :)
June 17th, 2005, 08:31 AM
It just copies your attachments over to the gallery. It does not touch the ones you have in your forum.
June 17th, 2005, 09:43 AM
wait...my attachments are stored on the DB, not as files on the server in a folder, is that the problem here?
June 17th, 2005, 09:47 AM
The script was created for the file system. Would it be a problem to move them?
June 17th, 2005, 09:49 AM
/me scratches head...
hell i dunno, ive never stored attachments on the local folders, its always been in the db. if i imported them over to a folder, would i get a problem? is it worth it?
June 17th, 2005, 12:17 PM
*As far as I know* there shouldn't be any probelms with you moving them over into the file system as long as your server is not running in safe mode. I know vB has quite a few checks in there when changing the storage method, so I don't think you would even be able to move them if there was going to be some kind of a problem. It really is better to store them as files anyways since they don't take up space in your database then.
June 17th, 2005, 01:05 PM
hmm i guess i could try it...
i have a very large attachment table on the site, so if i import them in, it might take a while....
now if that does happen, would u know if it will convert all the attachment information in threads also to point to the images in the folders?
does it dump the attachment DB also and just make the images in the folder?
few questions before i do something i might regret...but damn, gotta love SSH command to import the DB quickly ;)
June 17th, 2005, 01:09 PM
If you have a large amount of attachments, then you should already be storing them on the file system for best performance.
The vBulletin process to go back/forth between the storage types works fine, and won't affect the way your threads/attachments look/work today.
June 17th, 2005, 01:15 PM
is this alot?
Total Attachments 2,167
Disk Space Used 283.14 MB
Storage Type Attachments are currently being stored in the database
Average Attachment Filesize 133.8 KB
Total Downloads 106,312
June 17th, 2005, 01:26 PM
That's not a whole lot.
I have about 1.5gigs.
June 19th, 2005, 01:32 PM
i just converted the db to file system..i guess i gotta get use to the difference if there is any.
this will increase the performance of the site? will users and myself notice the difference?
June 19th, 2005, 04:51 PM
after i did this, the images imported fine, but the images were very large. no thumbnails..howcome?
June 19th, 2005, 05:00 PM
nevermind, just did the maintenance stuff and its fixed it looks like.
January 25th, 2006, 07:57 PM
Anybody have something like this for the newest version of vbgallery and vbulletin 3.5?
January 25th, 2006, 08:42 PM
No butt 1st time I seen it :)
should not be hard, but I am on bug patrol still.
January 28th, 2006, 12:20 AM
I'm sure I could get it to work but I'm too afraid I'd lose everything. :D If someone better at this than me could do it that'd be much appreciated. :D
September 12th, 2008, 08:53 PM
hmm this seems great! does this work with newer vbulletin and photopost pro?
September 13th, 2008, 10:43 AM
This is not a photopost pro discussion sorry.
vBulletin® v3.8.1, Copyright ©2000-2014, Jelsoft Enterprises Ltd.