migrating images from a 3rd party hosting

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
GorjancB
Registered User
Posts: 2
Joined: Fri Oct 22, 2021 10:31 pm

migrating images from a 3rd party hosting

Post by GorjancB »

I'm trying to create a script which will download all images linked in posts that are hosted elsewhere, then upload the files to my hosting and add attachment records into the table and insert attachment entry into the post_text. Where I'm having problems is figuring out why is there a seemingly random string in attachment tag?
Can anyone please clarify?
attach.JPG
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 5885
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: migrating images from a 3rd party hosting

Post by thecoalman »

I believe that is the bbcode_uid or something similar, that column is in posts table. Suggest upgrading as the newer format is easier to work with. Newest version of phpBB does not use that format and will be something like this:

Code: Select all

<ATTACHMENT filename="filename.jpg" index="6"><s>[attachment=6]</s>filename.jpg<e>[/attachment]</e></ATTACHMENT>
Instead of trying to attach them to posts it would be easier to upload them to single directory and then use find and replace in phpmyadmin to change the source URL.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
GorjancB
Registered User
Posts: 2
Joined: Fri Oct 22, 2021 10:31 pm

Re: migrating images from a 3rd party hosting

Post by GorjancB »

Yes, you're right, bbcode_uid is the field.

Also good idea about the find-replace, it really should be easier. Thank you!
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: migrating images from a 3rd party hosting

Post by 3Di »

GorjancB wrote: Sat Oct 23, 2021 1:18 pm Yes, you're right, bbcode_uid is the field.

Also good idea about the find-replace, it really should be easier. Thank you!
You can start from here, no need to re-invent the wheel
https://github.com/v12mike/fetch-external-images
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
Post Reply

Return to “phpBB Custom Coding”