Resize Attached Images (Updated for 2.0 RC4)

Started by Kays, October 17, 2009, 04:19:10 PM

Previous topic - Next topic

ModelBoatMayhem


Looking to install this mod but can I verify a couple of things first please:


1. Will it resize all new attachments to sizes set in Admin/Attachment Settings
      or Mod CP, which takes priority?

2. Will it allow any size photo upload even if Admin/Attachment Settings are set to say 200K?

3. I have over 6.4Gig of attachments. Will this mod go through and resize all of those?!


Thanks is advance,
Martin

NB: where can I find info on multiple Attachment directories?

That's my firm opinion.... but what do I know?!

Hristo

Why not install it on a test forum or even better a clone of your forum and test it how it works.

As for multiple Attachment directories, use this mod (it works just fine despite the warning):
http://custom.simplemachines.org/mods/index.php?mod=2851

ModelBoatMayhem


Some of these Mods work in a test environment but have given me problems when under 'load'!


Coping 8.4 Gigs to a test forum is going to be quite laborious !

That's my firm opinion.... but what do I know?!

Hristo

1. There is no such option (to set image dimensions limit) before the mod is installed so I'm not sure I understand the question.

2. If after resize the image is over the set limit (like 200k) it will not allow it to be attached

3. Yes, it can resize the pre-mod images. When "Resize existing images" is checked the bigger than the set size images get resized on the first load of the forum page on which they are shown. I suppose the goal of that is to spread in time the server load.

Still at least you have to backup before that. And since you have the backup...  Well, it's up to you.

Also you may consider using and another mod - Smush it:
https://github.com/Spuds?tab=repositories

http://www.simplemachines.org/community/index.php?topic=433547.0

ModelBoatMayhem

Re: 1

http://www.simplemachines.org/community/index.php?topic=342947.msg2314619#msg2314619

QuoteV2.0
Features added in the Attachment settings in the Admin CP.
- The ability to set a max width and height for attached images separately rather than using the values for posted images


SMF-S m u s h i t    looks interesting!
https://github.com/Spuds?tab=repositories
That's my firm opinion.... but what do I know?!

Hristo

Ah, you mean the attributes for the <img> tag (which no one should use at all). I suppose the pre 2.0's mod versions has used the options found in Layout's settings to get the values. It says clearly that they are independent of them.


Kays

Finally did get a chance to check it with a forum that has the old style encryption and the mod seems to work as it should with data similar to what you had posted.

So I guess that the next thing would be to verify the attachment directories and their ids. In the database settings table, look for the variable "attachmentUploadDir" and post the value. It's a serialised array so it might be a bit difficult for you to decipher.

@ModelBoatMayhem, did your questions get answered?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

lc62003

Cool.  It is:


a:2:{i:1;s:42:"/home/site/public_html/bbs/attachments2";i:3;s:41:"/home/site/public_html/bbs/attachments";}

Kays

OK, according to that, the folder with id 1, is the attachments2 folder and the folder named attachments has the id of 3. Which is odd since normally id 1 is the original attachments folder. Unless it was named attachments2 to start with. ???

That image which is giving you the problem, which folder is it in? attachments or attachments2?

Files with the old style encryption for the file name, are they only in one folder or in both?

Do you see any files with just the file name in either folder. These would be the first attachments uploaded going way back. If so, in which folder? Which folder is it in according to the database (1 or 3)? Also, can you view these in the attachments listing in the admin cp?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

lc62003

Strange indeed.  Story of my life.   ;D

The example file is in attachments.

They appear to be in both.  Here is a sample file from attachments2:

181011_9fb76b92ef5f6a7619ba8009b765fcbac3a     Or is this different?  The original file name does not appear to be present here.   ???

No, they are all that configuration. 

Yes, I see the example pic listed in the CP.  If I click the link there same result....404. 

lc62003

I realize you are a volunteer so sorry to push a bit.  Sure would be nice to solve this issue.  My forum is tech heavy, meaning it relies on pix.  Now many are missing.  Heck, I begged for this functionality to be included in future SMF versions.   ;)

Kays

181011_9fb76b92ef5f6a7619ba8009b765fcbac3a is the format currently used for naming attachments. Which is the file id followed by the file_hash. If there's no value for file_hash in the database. then the old format is used. Ether just the file name or as in your case the old style encryption which included the file id, file name and a hash of the file name

Getting back to this from the previous page.

Quote
Here is an example of a pic that doesn't work:   

in attachments:
117963_DSCF0958_JPG3497f7e437ffce635e7095e


Here is the corresponding database entry:

id_attach  id_thumb  id_msg    id_member  attachment_type      filename    size    downloads  width  height  approved  fileext  mime_type  id_folder  file_hash
117963       136432  1110539    0        0                      DSCF0958.jpg    56801    421         800    600        1              jpg    image/jpeg    3   


In looking through this thread there was a problem reported when the extension on the file name was in upper case. In the example above, extension for the name on the file in the attachments2 folder is in uppercase. While the name in the database shows the extension being in lowercase. This was suppose to be fixed. But maybe not... ::)

For the above file, or one similar, try changing the name in the database so that the extension is in upper case.

Do the thumbnails show for these images?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

lc62003

Changing to upper case in the DB is a no-go.  No thumbnails either.   :(

lc62003

A few days shy of 3 mos.  Thanks for your time.  I'm done with this one.

Beer

#255
 Good day!
How to make resized images were 100 pix less than specified in the properties admin area?

For example:
1000ps - the maximum image width of the admin area (httр:hxxp:site.beer/forum/index.php?action=admin;area=featuresettings;sa=layout; [nonactive])
if load 1000px - not resized;
if load 1200px - working Image Resize to 900 (httр:hxxp:site.beer/forum/index.php?action=admin;area=manageattachments;sa=attachments). [nonactive]

Thank you! ;)

KungFuJoe

It appears as if the attachment size check occurs BEFORE the resizing.

For example, on my site, I left the attachment size limit to default (I believe it's 128kB).  I then tried to upload a pic that was about 2MB in size.  After uploading, I got an error message about it being too large.

So I went back and set the attachment size limit to 0 (disabling it).  Uploaded the same photo, and after it was posted, it said the size was 61kB...which should have been small enough to let it through the first time around.

melanieh75

Running SMF 1.1.19
Applied mod "Resize Attached Images" and it works fine. But, there is one topic that is not working. After removing the mod, the topic is fine and looks normal. Install the mod again and again it breaks this one topic.

If you try to view the topic, the following error comes up:

QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'S 1958 8.jpg'
    WHERE ID_ATTACH = 9670
    LIMIT 1' at line 2
    File: /home/fundubsc/public_html/SimpleMachinesForum/Sources/Display.php
    Line: 1228

    Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 1.1.19, while your database is at version 1.1.11. The above error might possibly go away if you execute the latest version of upgrade.php.


Again, all other topics appear OK, just this one that is no longer working.

melanieh75

I wonder if this thread is being monitored anymore?

Westwegoman

Great mod. But I have a small problem. While going through a bunch of post, I noticed that a few post only come up as a white screen. If I uninstall the package, these post are visible again. The image in the post is 1846kb which is half the size of images in other post that came up and resized with no problem.

I tried changing the @ini_set('memory_limit', '90M'); to as high as 300 but no luck.

Any ideas?

Advertisement: