Recover images in posts

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
waazdakka
Registered User
Posts: 3
Joined: Fri Feb 23, 2024 6:59 pm

Recover images in posts

Post by waazdakka »

Hello all!
First of all, thanks for the great support everyone brings here, it helps a lot!!

But since I'm not able to find a solution to my problems, here is my first topic here!

I'm taking over the management of a very old phpBB forum, (since more than 10 years...) and some datas has been lost in May 2020 apparently following an upgrade of the forum.
In fact, all the posts are here, but a lot of pictures has been lost in the process.

It turns out that there are a lot of files missing from the phpbb_attachments table, but luckily I recovered a backup from December 2019, knowing that the update that messed up a lot of stuff dates from May 2020. Too bad, we're doing with what we have.

Exploring the database and the folders Good news! All the files are still in the /files folder.

I ran a test with a post in which 3 images are missing.
In the phpbb_posts table, I find the corresponding post, and the attachments which should be displayed.

An example: https://www.citroen-ac4.fr/forumclub/topic?p=44066

Code: Select all

<ATTACHMENT filename="Citroën.JPG" index="1"><s>[attachment=1]</s>Citroën.JPG<e>[/attachment]</e></ATTACHMENT>
<ATTACHMENT filename="Torpedo.JPG" index="2"><s>[attachment=2]</s>Torpedo.JPG<e>[/attachment]</e></ATTACHMENT>
<ATTACHMENT filename="cascade.JPG" index="0"><s>[attachment=0]</s>cascade.JPG<e>[/attachment]</e></ATTACHMENT>
I look in the phpbb_attachments table, indeed the link with the file stored with the phpbb id is missing. So I do my sql query to add the physical file / ID correspondences in the database

Code: Select all

INSERT INTO phpbb_attachments VALUES (991, 44062, 4548, 0, 755, 0, '755_aa4e81c52b70b46e17aff5944b9f3887', 'cascade.JPG', 996, '', 'jpg', 'image/jpeg', 42529, 1298645187, 0), (989, 44062, 4548, 0, 755, 0, '755_c77e9de19320a1ac2403c371807de5a2', 'Torpedo.JPG', 999, '', ' jpg', ' image/jpeg', 49554, 1298644016, 0)
Everything looks fines but... The post doesn't display the images :(

I emptied the cache,

Did I miss something to link the physical_filename and the real_filename ?

Tell me if I can provide more usefull informations!

Thanks a lot!!!
Last edited by Mick on Sun Feb 25, 2024 9:00 am, edited 1 time in total.
Reason: Solved.
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6007
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Recover images in posts

Post by thecoalman »

If you edit the post are the files still listed as attached under the attachment tab?
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
waazdakka
Registered User
Posts: 3
Joined: Fri Feb 23, 2024 6:59 pm

Re: Recover images in posts

Post by waazdakka »

Hello,
No attachment in the files tab :(
Screenshot_2024-02-24-12-40-34-53_984e1414ae90666a90f12ff17ec14a7f.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6007
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Recover images in posts

Post by thecoalman »

Someone must of deleted them from the post then. In the post table is a post_attachment field that needs to be set to 1.

Code: Select all

UPDATE phpbb_posts
SET post_attachment = 1
WHERE post_id = 123456;
123456 is the post ID of the specific post.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
waazdakka
Registered User
Posts: 3
Joined: Fri Feb 23, 2024 6:59 pm

Re: Recover images in posts

Post by waazdakka »

Wow amazing I missed that...

Now I have to find how to filter the missing attachments, the existing posts where the post_attachment field is set to 0 instead of 1... Or I just put all the post_attachment field to 1 and insert the missing keys into phpbb_attachments? Not yet sure of the less dirty method I'm going to use :lol:

Return to “[3.3.x] Support Forum”