Create thumbnails doubles the number of files

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
gvp9000
Registered User
Posts: 59
Joined: Mon Oct 02, 2023 4:03 pm

Create thumbnails doubles the number of files

Post by gvp9000 »

The option "Create thumbnail" in ACP "Attachment settings" doubles the number of image files in "Files" folder.
One file has a name of "userid_xxxxxxxxxxxx" and the second one "thumbs_userid_xxxxxxxxxxxx".
My hosting provider has an inodes limitation so

1. Can I disable "Create thumbnail" option in ACP, delete all the "thumbs_userid_xxxxxxxxxxxx" files and run an sql script in order to replace all the (already posted) attachament's name in posts table removing the "thumbs_" prefix ?
What i'm asking is to convert my site like it would be without enabling "Create thumbnail" from the beginning.

2. Is there any way to block the creation of "thumbs_" files and still be able to create thumbnails on every page request stored in cache folder, where i would be able to delete them whenever i decide ?

Thanks in advanced.
Last edited by Mick on Mon Dec 04, 2023 11:09 am, edited 2 times in total.
Reason: Solved.
gvp9000
Registered User
Posts: 59
Joined: Mon Oct 02, 2023 4:03 pm

Reverting img attachment to original images without thumbnails

Post by gvp9000 »

spinecki wrote: Sun Dec 11, 2022 8:34 pm Hi,

Is there a way of coming back from using thumbnails for attachment to not using thumbnails?

I disabled thumbnails in options, even changed max width/height to 300px (from original 650px), but all the attached images posted before that change are still having thumbnails. Is there a way of changing them back to original images?

Thanks!
In the database sql file, find "INSERT INTO `phplm_attachments`
You will see something like this

Code: Select all

INSERT INTO `phplm_attachments` (`attach_id`, `post_msg_id`, `topic_id`, `in_message`, `poster_id`, `is_orphan`, `physical_filename`, `real_filename`, `download_count`, `attach_comment`, `extension`, `mimetype`, `filesize`, `filetime`, `thumbnail`) VALUES
(39, 169, 14, 0, 2, 0, '2_de4895a129c8da51f712b2fae81a039d', 'Untitled 1.jpg', 1, '', 'jpg', 'image/jpeg', 202625, 1701679439, 0),
(40, 170, 14, 0, 2, 0, '2_4ef2c1cd98609339c05f7c2d1cbfe22b', 'Untitled 1.jpg', 1, '', 'jpg', 'image/jpeg', 202625, 1701679866, 1);
The last number 0 or 1 in every row tells phpbb if a photo will be presented as thumbnail or not.
0 means original image.
1 means like thumbnail.
So if you change the last "1" to "0" in the second row the image will be reverted to the original image.

I'm not a professional developer try it first in a test board.
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26679
Joined: Fri Aug 29, 2008 9:49 am

Re: Create thumbnails doubles the number of files

Post by Mick »

Those settings are used at the time the image is attached, to revert them you would need to re-attach each image. There’s nothing available within default phpBB to do that, you would need an extension.
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel©
🇬🇧
User avatar
warmweer
Jr. Extension Validator
Posts: 11407
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: Reverting img attachment to original images without thumbnails

Post by warmweer »

gvp9000 wrote: Mon Dec 04, 2023 9:07 am
spinecki wrote: Sun Dec 11, 2022 8:34 pm Is there a way of coming back from using thumbnails for attachment to not using thumbnails?
In the database sql file, find "INSERT INTO `phplm_attachments`
You will see something like this

Code: Select all

INSERT INTO `phplm_attachments` (`attach_id`, `post_msg_id`, `topic_id`, `in_message`, `poster_id`, `is_orphan`, `physical_filename`, `real_filename`, `download_count`, `attach_comment`, `extension`, `mimetype`, `filesize`, `filetime`, `thumbnail`) VALUES
(39, 169, 14, 0, 2, 0, '2_de4895a129c8da51f712b2fae81a039d', 'Untitled 1.jpg', 1, '', 'jpg', 'image/jpeg', 202625, 1701679439, 0),
(40, 170, 14, 0, 2, 0, '2_4ef2c1cd98609339c05f7c2d1cbfe22b', 'Untitled 1.jpg', 1, '', 'jpg', 'image/jpeg', 202625, 1701679866, 1);
The last number 0 or 1 in every row tells phpbb if a photo will be presented as thumbnail or not.
0 means original image.
1 means like thumbnail.
So if you change the last "1" to "0" in the second row the image will be reverted to the original image.

I'm not a professional developer try it first in a test board.
There's a relatively easy way to fix that based on gvp9000 's info.

First of all, disable your board so that nobody can post (attachments).
Take a backup of the phplm_attachments table using the ACP backup feature (you'll find it in /store). and even take a full backup just to make sure.

Take a copy of that phplm_attachments.sql (just in case)
Open the phplm_attachments.sql in a text editor (not Windows notepad, but Notepad+ or similar)

Now you can search and replace , 1) with , 0).
Save that and upload that new phplm_attachments.sql to store.
In the ACP restore that (new) attachments table.

If it doesn't work out as intended/expected, you can always restore the original backup table.

Once you're happy with the result, you can delete the thumbnails. (and take a new full backup)
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
gvp9000
Registered User
Posts: 59
Joined: Mon Oct 02, 2023 4:03 pm

Re: Reverting img attachment to original images without thumbnails

Post by gvp9000 »

warmweer wrote: Mon Dec 04, 2023 9:50 am
That is exactly what I did.
Open the phplm_attachments.sql file with notepad++ search and replace ", 1)" with ", 0)" and restored it.
It worked for inline and attached photos.

No need to re-upload all the photos from the beginning !!!!
Then you can delete all the thumb_ files.
gvp9000
Registered User
Posts: 59
Joined: Mon Oct 02, 2023 4:03 pm

Re: Create thumbnails doubles the number of files

Post by gvp9000 »

Mick wrote: Mon Dec 04, 2023 9:18 am Those settings are used at the time the image is attached, to revert them you would need to re-attach each image. There’s nothing available within default phpBB to do that, you would need an extension.
I've tested it. it works. No need to re-attach each image.
I don't know about quoted images but i'll test it this afternoon and report back.
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26679
Joined: Fri Aug 29, 2008 9:49 am

Re: Reverting img attachment to original images without thumbnails

Post by Mick »

Have items 1 & 2 in your first post been satisfied because this topic seems to have wandered?
  • "The more connected we get the more alone we become" - Kyle Broflovski©
  • "The good news is hell is just the product of a morbid human imagination.
    The bad news is, whatever humans can imagine, they can usually create.
    " - Harmony Cobel©
🇬🇧
gvp9000
Registered User
Posts: 59
Joined: Mon Oct 02, 2023 4:03 pm

Re: Reverting img attachment to original images without thumbnails

Post by gvp9000 »

No problems with reply.
I' ll do it in the production site.
Interrupt all user connections before doing this.
Last edited by gvp9000 on Tue Dec 05, 2023 6:37 am, edited 1 time in total.
gvp9000
Registered User
Posts: 59
Joined: Mon Oct 02, 2023 4:03 pm

Re: Reverting img attachment to original images without thumbnails

Post by gvp9000 »

Mick wrote: Mon Dec 04, 2023 10:32 am Have items 1 & 2 in your first post been satisfied because this topic seems to have wandered?
Yes ... satisfied , sorry for this ...
You can lock it or move it if you want.
User avatar
warmweer
Jr. Extension Validator
Posts: 11407
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: Reverting img attachment to original images without thumbnails

Post by warmweer »

Mick wrote: Mon Dec 04, 2023 10:32 am Have items 1 & 2 in your first post been satisfied because this topic seems to have wandered?
My mistake :oops:
I thought this was a support topic for spinecki, but I now see that that is another (old) topic: viewtopic.php?p=15910161#p15910161
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.

Return to “[3.3.x] Support Forum”