Reducing size of legacy attachments

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
YabbaDabbaDoo
Registered User
Posts: 2
Joined: Sun Dec 17, 2017 11:23 pm

Reducing size of legacy attachments

Post by YabbaDabbaDoo » Sun Dec 17, 2017 11:28 pm

I want to edit attachments in the "files" folder, as they have grown huge over the years.

I have tried downloading a test attachment by FTP, adding a .jpg extension, resizing, and then reuploading. The file appears to overwrite, but the original file remains in place, both as per FTP display and on the phpBB board.

Is there a way to resize attachments other than editing each post?

YabbaDabbaDoo
Registered User
Posts: 2
Joined: Sun Dec 17, 2017 11:23 pm

Re: Reducing size of legacy attachments

Post by YabbaDabbaDoo » Mon Dec 18, 2017 6:20 am

PS - I remove the .JPG extension before reuploading.

I assume there is some quality about the extensionless files in the "files" attachment folder that makes them difficult or impossible to edit?

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 48124
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Reducing size of legacy attachments

Post by stevemaury » Mon Dec 18, 2017 4:39 pm

So, you are saying your server allows you to have two files with the same name in the same folder?

Note that not all attachments are .jpg files.

When an attachment is uploaded, its name is replaced with a randomly generated hex string and its extension is removed. This both allows two different files with the same real filename to co-exist in the /files folder, as they now have different physical filenames, and adds security by hiding the file type.

The attachments table in the database keeps track of what real filename corresponds to each physical filename. It also keeps track of the filesize. So, I THINK that once you change the filesize, the reduced size file is not recognized by the database.

I do not believe there is an easy way to do what you want. I think you would have to download the physical file, determine its real name from the database and rename it, delete the attachment from the post, reduce the size of the file, and edit the post to add the reduced file as an attachment.
For REALLY good and VERY inexpensive hosting CLICK HERE

All unsolicited PMs will be ignored.

Post Reply

Return to “[3.2.x] Support Forum”

Who is online

Users browsing this forum: Bricky, invenio, kholman, sakm and 34 guests