Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Kays on October 17, 2009, 04:19:10 PM

Title: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on October 17, 2009, 04:19:10 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=2206)

Automatically resizes attached images to the same dimensions as for posted images.

This mod will resize all attached .jpg, .png, .gif, or .bmp images save them as .jpg. Either as they are being uploaded, or for existing images, when they are viewed. As well, any existing .png, .gif, or .bmp images will be converted to .jpg.

Note:

Due to a problem with the mod creating extra thumbnails. I would advise anyone using V1.1 to update to V1.2. As well, upload this script (http://www.simplemachines.org/community/index.php?action=dlattach;topic=342947.0;attach=122255) the root of your forums and access it by url to clean up any extra thumbnails

V1.1 Initial release
V1.2 Fixed a bug where extra thumbnails were created
V1.3 Updated for SMF 2.0
V1.4 Fixed a bug with files not being renamed if encrypted file names was enabled before SMF 1.1.9 or 2.0 RC1.1.
V1.5 Minor fixes



V2.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
- The ability to set the jpeg compression factor.
- The option to save thumbnail either as .jgp or .png. independent of the avatar setting.
- Change existing  .png images back to .jpg.

V2.0.1 Added Russian & Russian-utf8. Thanks to Bugo.
V2.1.1 Fixed a bug with the width on resized images.
V2.2.1 Updated for 2.0 RC4
Title: Re: Resize Attached Images
Post by: gourav on October 19, 2009, 02:09:49 PM
Hey dear great mod :) i was in search of something like this
Well can you clear out one thing , Will this mod resize the images
everytime it will be loaded or it will permanently replace the uploade
i.e. will Resize ythe original pic forever?

and can v manually choose the resize dimensions
Title: Re: Resize Attached Images
Post by: Kays on October 19, 2009, 07:44:24 PM
Hi, this mod is for those who wish to cut down on server space. So it does permanently resize all attached images.

The settings are the same as for posted images. Admin CP > Features and Options > Max width of posted pictures, Max height of posted pictures
Title: Re: Resize Attached Images
Post by: ddarrell on October 19, 2009, 08:31:39 PM
Very nice, Thank You.

Successful install on 1.1.10.

:)
Title: Re: Resize Attached Images
Post by: avf on October 30, 2009, 04:44:17 PM
I installed on SMF  but strangely the attachment folder has swelled upto 44000 files and 500MB with
names like

1536_164d9fd9aa92e415a370338257c4031f54fdd2a1
1047_IMG_4352_resize_jpg0ae79bd3f4292253353258c7b2b93b2a
1050_IMG_4355_resize_jpg2a1fcff297c2c737ddc2e5389abd5196

can you tell if it is duplicating the files or what is happening. I don't have that many attachments in my forum. Please advice I am running out of space on my server.

It appears to have created a huge number of small files upto 10kb on just one day so I know they are not new attachments and the total seems to have jumped from 2000 odd attachments to 44000 now.

I am also using the highslide viewer mod. is it causin the image to be resized multiple times as it is viewed ? this mod http://custom.simplemachines.org/mods/index.php?mod=1450
Title: Re: Resize Attached Images
Post by: Kays on October 30, 2009, 05:07:56 PM
1536_164d9fd9aa92e415a370338257c4031f54fdd2a1 is the proper format for attached files. I don't know where the others are coming from.

Do you have any other mods installed which affect attachments?

Title: Re: Resize Attached Images
Post by: avf on October 30, 2009, 05:15:53 PM
It appears to have created a huge number of small files upto 10kb on just one day so I know they are not new attachments and the total seems to have jumped from 2000 odd attachments to 44000 now.

I am also using the highslide viewer mod. is it causin the image to be resized multiple times as it is viewed ? this mod http://custom.simplemachines.org/mods/index.php?mod=1450
Title: Re: Resize Attached Images
Post by: Kays on October 30, 2009, 06:55:46 PM
It doesn't look like it's that mod.

Do you see them in the Admin CP when viewing the attachements?

If you have database access, do you see them in the attachments table. The first numbers of a file name before the first underscore (_) is the attachment id. You should be able to use that if checking the database or look for a repitition of this in the file names.
Title: Re: Resize Attached Images
Post by: avf on October 31, 2009, 02:06:16 AM
Here is what is happening. I disabled the highslide viewer mod and uploaded a pic. The attachments table showed me 44673 rows after the upload and I saw my image had been uploaded as the last one.

After that i enabled the highslide viewer mod so all images now displayed as thumbs. I clicked on the same thread again to view the last post with image and in the table the number of entires jumped to 44713 and i saw new entries for all images in that thread named xxxxxx.jpg_thumb size(200x200). So I guess all images in the thread opened are instantly resized and renamed as xxx.jpg_thumb.

Once i disable the highslide viewer mod then it doesnt happen. However I do know this did not happen earlier with just the highslide viewer mod and is a conflict with resize image mod and highslide viewer.

Please advice.................
Title: Re: Resize Attached Images
Post by: avf on October 31, 2009, 05:41:36 AM
What also i would like to know is Can I delete the rows in the attachments table with files like %.jpg_thumb ? That would clean out 42000 rows. However i am now unable to view the files in the server as my ftp software allows me to view only 2000 files. I want to delete the same files in the attachment folder to reclaim server space.
Title: Re: Resize Attached Images
Post by: Kays on October 31, 2009, 09:24:16 AM
SMF 1.1 or 2.0?

I'd like to install it on a test forum to see what is happening.
Title: Re: Resize Attached Images
Post by: avf on October 31, 2009, 11:12:50 AM
SMF 1.1.10
Title: Re: Resize Attached Images
Post by: Kays on October 31, 2009, 01:35:53 PM
Thanks. It does look like there's a problem with my mod and it's continually ceating thumbnails.

Please uninstall it until i get a chance to fix the problem. I'll also try to write a utility to clean up the extra thumbnails created.
Title: Re: Resize Attached Images
Post by: avf on October 31, 2009, 06:09:40 PM
Quote from: Kays on October 31, 2009, 01:35:53 PM
Thanks. It does look like there's a problem with my mod and it's continually ceating thumbnails.

Please uninstall it until i get a chance to fix the problem. I'll also try to write a utility to clean up the extra thumbnails created.

I have disabled the slide viewer as I would rather have members upload larger files. The extra files created have created a havoc and I have to cleanup almost 44400 files and i cannot even download them as well as view them in FTP s/w. The cleaner QUICKLY would be highly appreciated.
Title: Re: Resize Attached Images
Post by: Kays on November 01, 2009, 01:36:00 PM
Hi, I do have something working. But I've got a concern over the large number of queries involved. Especially in your case.

Could you possibly create a backup of just the attachments table so it can use it for testing?
Title: Re: Resize Attached Images
Post by: avf on November 01, 2009, 02:11:15 PM
its not working the backup is more than 500MB and the attachments folder shows me 44700 rows. the problem now is the format of images name is changed from the orignal smf format. even when i updat the files from the eaarlier backup the images are broken in the forum
Title: Re: Resize Attached Images
Post by: Kays on November 04, 2009, 09:39:24 AM
Hi, sorry about the delay.

Upload the attached file to the root of your forum and access it by url (hxxp://MySite.com/forums/clean_thumbs.php)

I've also uploaded a corrected verson of the mod. Do uninstall the old version and replace it with the new one.

Note:
I'd advise anyone using V1.1 of this mod to uninstall it and install V1.2. Then run the attached script to remove any extra thumbnails created. It willl work for both SMF 1.1 as well as SMF 2.0
Title: Re: Resize Attached Images
Post by: jeffrey scott on November 04, 2009, 10:39:47 AM
Quote from: Kays on November 04, 2009, 09:39:24 AM
Hi, sorry about the delay.

Upload the attached file to the root of your forum and access it by url (hxxp://MySite.com/forums/clean_thumbs.php)

I've also uploaded a corrected verson of the mod. Do uninstall the old version and replace it with the new one.

Note:
I'd advise anyone using V1.1 of this mod to uninstall it and install V1.2. Then run the attached script to remove any extra thumbnails created. It willl work for both SMF 1.1 as well as SMF 2.0

How do I run that clean up script Kays?

thanks

Jeff
Title: Re: Resize Attached Images
Post by: Kays on November 04, 2009, 11:07:27 AM
You upload it to the root of your forum, the same place as SSI.php. Then access it by url  like so: hxxp://MySite.com/forums/clean_thumbs.php
Title: Re: Resize Attached Images
Post by: avf on November 05, 2009, 02:05:14 AM
Super awesome ! You have made a great mod and also supported it which is even better. I was so happy to recover almost 500mb of server space after the orphaned files were deleted. Thanks and congrats on this wonderful mod. I think it should be incorporated with the forum itself.

There is still one "issue" i would like to point out. When used with the high slide viewer which basically shows all the images as thumbs and when clicked on expands to show the actual image it is creating 2 images for every upload. One is the actual uploaded one and the other is the thumb image. Is that because of your mod or the high slide viewer ?

AVF
Title: Re: Resize Attached Images
Post by: Kays on November 05, 2009, 10:35:02 AM
I couldn't reproduce that problem on 2.0 and didn't check it on a 1.1 forum. I'll do that later when I get a chance.

Are the file names as you described earlier?  1050_IMG_4355_resize_jpg2a1fcff297c2c737ddc2e5389abd5196

Do you see them in the database?
Title: Re: Resize Attached Images
Post by: avf on November 05, 2009, 02:19:29 PM
i see them in the attachments table as follows

44890     0     18949     0     3     abc.jpg_thumb     7348     0     130     200     e99b1e88ec51848a30f04b6d13b1cb07699dc2d4
   Edit    Delete    44889    44890    18949    0    0    abc.jpg    42826    1    390    600    911720651ba39007e9cc7f654d0c0b6769913d88

the files are named 44890_e99b1e88ec51848a30f04b6d13b1cb07699dc2d4
Title: Re: Resize Attached Images
Post by: Kays on November 07, 2009, 11:29:32 AM
I can't seem to reproduce this problem on a 1.1.10 forum.


44890     0     18949     0     3     abc.jpg_thumb     7348     0     130     200     e99b1e88ec51848a30f04b6d13b1cb07699dc2d4
44889    44890    18949    0    0    abc.jpg    42826    1    390    600    911720651ba39007e9cc7f654d0c0b6769913d88


This is normal for the database entries. The second entry is the original image and the first one is the thumb. Since SMF 1.1.9, the files in the attachments folder are now named as such:

44889_911720651ba39007e9cc7f654d0c0b6769913d88
44890_e99b1e88ec51848a30f04b6d13b1cb07699dc2d4


With the file id followed by the file hash.

Title: Re: Resize Attached Images
Post by: lala1 on November 12, 2009, 02:09:47 AM
Hello!

Great mod, I've been looking for this feature for a long time now. There is one problem though, since I'm running a forum where users display lots of images per thread (40-50 sometimes), it takes a very long time for the server to resize the images and it seems to me that it is doing it every time a page is being accessed.

Is there an option that I'm constantly missing and that would allow the server to resize the images once for good?
Title: Re: Resize Attached Images
Post by: Kays on November 12, 2009, 10:50:06 AM
Hi, this mod does only resiize the image once.

With that many images on a page it will take some time for all of the thumbnails to be loaded. Old thumbnails might be .png files which at times can be of a larger file size than the .jpg image. Depending on the size of the thumbnails.

Re-sizing the thumbnails will force new ones to be created which are .jpg. But also may leave extra files on the server which can be removed with that script I posted earlier.
Title: Re: Resize Attached Images
Post by: lala1 on November 15, 2009, 01:57:30 PM
All the thumbnails on that forum are jpg for a long time now. Still, when accessing a thread with multiple images attachments IF this mod is active, it takes the browser about 2 minutes to display the page. Upon refreshing the same page, same thing occurs. But if I disable this mod, things speed up considerably (less than 30 seconds).

I'm using highslide viewer also, but I disabled it and same thing occurs. Might be some checkup?

Thanks,
lala
Title: Re: Resize Attached Images
Post by: Kays on November 15, 2009, 02:52:25 PM
I did verify that the mod only resized once before making that statement. So I'm a bit baffled

Which version of the mod are you using? And which version SMF?
Title: Re: Resize Attached Images
Post by: lala1 on November 16, 2009, 01:35:22 AM
Resize Attached Images v1.3
SMF 2.0 RC2
Host: Dreamhost

It might be some checkup that the script is performing upon accessing a page.

Thanks for your support :)
lala
Title: Re: Resize Attached Images
Post by: samurai-lupin on November 24, 2009, 01:12:49 AM
Hello, I have just updated this great mod and wanted to remove my duplicate thumbnails but received this error when running your script:

Unknown column 'file_hash' in 'field list'
File: /home/atanua/public_html/smf/clean_thumbs.php
Line: 127

I'm using 1.1RC2

Unfortnately by creaiting double thumbnails by inodes have risedn to close to 80.000 in my attachments folder.

Any help is appreciated.

Thank you!
Title: Re: Resize Attached Images
Post by: Kays on November 24, 2009, 06:59:09 AM
@samurai-lupin
I would strongly recomend that you upgrade to 1.1.10 due to a number of security fixed which have been implimended.

Open clean_thumbs.php and on line 122 remove the ", file_hash" so that line now looks like


SELECT filename, ID_ATTACH


That should get it to run.

@lala1
Sorry about the delay. 

if you wish to check if this mod is causing the slow down. with the mod installed, open Sources/Display.php

Look for:


// Find the new dimensions and size


and above it add:


log_error('Image resized - ' . $attachment['filename']);


then look for:


// So what folder are we putting this image in?


And above it add:


log_error('Thumb resized - ' . $attachment['filename']);


Doing this will add an entry to the error log, assuming that it is enabled, every time an image is resized or a new thumbnail is created. If the mod is functioning correctly, you should not see any items repeated.
Title: Re: Resize Attached Images
Post by: samurai-lupin on November 24, 2009, 09:15:45 AM
Quote from: Kays on November 24, 2009, 06:59:09 AM
@samurai-lupin
I would strongly recomend that you upgrade to 1.1.10 due to a number of security fixed which have been implimended.

Open clean_thumbs.php and on line 122 remove the ", file_hash" so that line now looks like


SELECT filename, ID_ATTACH


That should get it to run.


Thank you. What about the id_folder?

Should it be
         SELECT filename, id_attach, id_folder

or?

         SELECT filename, id_attach

Thanks a lot!
Title: Re: Resize Attached Images
Post by: Kays on November 24, 2009, 09:26:33 AM
No, look further down. That is for 2.0.

"ID_ATTACH" should be upper case since you are using SMF 1.1
Title: Re: Resize Attached Images
Post by: samurai-lupin on November 24, 2009, 03:08:15 PM
ATTENTION ALL - DO NOT USE THIS MOD OR ESPECIALLY NOT THE clean-thumbs.php BY ANY MEANS!!! I JUST DID SO AND IT DELETED ALL MY ATTACHMENTS !!! THIS THIBG WILL KILL YOUR FORUM AND IS NOT WORKING!!! BEWARE!!!

IT CAUSED TREMENDOUS DAMAGE TO MY FORUM! THIS MOD HAS TO BE DELETED!!!
Title: Re: Resize Attached Images
Post by: lala1 on November 30, 2009, 02:38:10 AM
@samurai-lupin: this was a stupid thing to do. this guy really supports his mods; more than that you should have made backups, but hey, the smartest thing to do is to yell here, isn't it?

@Kays: thanks for support, I will check that as soon as possible. Keep up the good work and ignore the rest!
Title: Re: Resize Attached Images
Post by: samurai-lupin on November 30, 2009, 04:36:31 AM
Lala, if you install a mod reported to be safe and then it almost kills your forum I'm sure you would be happy as you are a most smart person. I hope you will get the chance to enjoy this situation at some point in the future.
Title: Re: Resize Attached Images
Post by: Arantor on November 30, 2009, 07:52:11 AM
samurai-lupin: Please edit your above post to resize the font.

I tested this mod pretty thoroughly, and could not make it do what you are saying it did.
Title: Re: Resize Attached Images
Post by: samurai-lupin on November 30, 2009, 08:00:20 AM
Unfortunately it really does and the mod author has aggreed to this as well. I wish it was different. However the mod author has said he would fix th problem. Once he has I will remove my posting. Meanwhile I would urge anybody using a pre 1.1.4 installation not to use this mod.
Title: Re: Resize Attached Images
Post by: Arantor on November 30, 2009, 08:07:31 AM
I would hope few people don't use forums that old now due to numerous security issues. I would also ensure the directions given in the package manager are followed, i.e. "make sure you have backups".

When I originally reviewed this mod, clean-thumbs.php did not exist; we also do not do period reviews, though after the unsafe report I still couldn't get this to misbehave.
Title: Re: Resize Attached Images
Post by: Kays on November 30, 2009, 09:02:12 AM
samurai-lupin, as I indicated in PM, the problem was not with the clean_thumbs script but rather with the mod and the version of SMF which you are using. As well, it didn't break your forum since the only files affected were the ones with .JPG in uppercase.

I have offered to correct the problem, but so far have not received any reply from you either in the form of a reply PM or removal or edit of that post.
Title: Re: Resize Attached Images
Post by: Norv on December 01, 2009, 06:34:02 PM
Quote from: samurai-lupin on November 30, 2009, 08:00:20 AM
Meanwhile I would urge anybody using a pre 1.1.4 installation not to use this mod.

Nobody should be using such an outdated version. There were security vulnerabilities found meanwhile, which put all your data in danger, not only some. IMHO, I would not expect mod authors to have their mods tested on any outdated version of SMF, that would be a lot of work for no real benefit. Sorry.
Title: Re: Resize Attached Images
Post by: Arantor on December 01, 2009, 06:35:44 PM
Quote from: Norv on December 01, 2009, 06:34:02 PM
IMHO, I would not expect mod authors to have their mods tested on any outdated version of SMF, that would be a lot of work for no real benefit. Sorry.

Just to confirm, we (Cust team) do not test on older versions without very strong reason; this mod was tested on 1.1.10 and no issues were found at the time we approved it.
Title: Re: Resize Attached Images
Post by: Gargoyle on December 01, 2009, 08:03:32 PM
Thanks for the thumb script.... LOL I had like 30K worth
Title: Re: Resize Attached Images
Post by: jeffrey scott on December 14, 2009, 06:23:45 PM
Hi Kays,

Thanks again for a great mod, I am just going to uninstall version 1 and run the remove thumbs file.

I have done this on my test forum and all good, but on my main forum as I go to run the uninstall of the mod it fails on the ./Sources/Display.php file.

I don't know why? I have the advertising package, resize mod and watermark mods installed and am currently using smf V 1.1.11

Would you suggest I do a manual deinstall? and how would I do that?

Thanks

Jeff
Title: Re: Resize Attached Images
Post by: Kays on December 14, 2009, 07:17:05 PM
Hi, you will need to do a manual uninstall then.

Unfortunately, I've been deleting older packages so you can't parse it to see the changes. Backup Display.php first and then uninstall the mod. This will make all of the changes to display.php except for where the error is. Now open install_11.xml and look for the changes in Display.php and verify that they were made. If the change wasn't made., do so.

This miight help except that the changes are in reverse.

Manual Installation of Mods (http://docs.simplemachines.org/index.php?topic=402.0)
Title: Re: Resize Attached Images
Post by: lala1 on December 20, 2009, 09:37:04 AM
Quote from: lala1 on November 15, 2009, 01:57:30 PM
All the thumbnails on that forum are jpg for a long time now. Still, when accessing a thread with multiple images attachments IF this mod is active, it takes the browser about 2 minutes to display the page. Upon refreshing the same page, same thing occurs. But if I disable this mod, things speed up considerably (less than 30 seconds).

Solved, the height of the posted images was set to 0 in the admin panel. For some reason, because of this the access time was prolonged.

Now it's set at a above zero value and your script works wonders! Thank you! :)
Title: Re: Resize Attached Images
Post by: Kays on December 20, 2009, 10:21:24 AM
Thanks for getting back to me on that.

I've got to check it out to see why that is happening.
Title: Re: Resize Attached Images
Post by: yol on January 14, 2010, 09:40:42 PM
Hi,

Firstly thank you for your work Kays. When I install this mod, all gif animations converted to jpg file. So animations wasnt work, frozen :) I deleted the lines on Subs-Graphics.php and everything work well. I think gif formats must not converting to jpg format.

Best regards,
Sedat

case IMAGETYPE_GIF:
$image = imagecreatefromgif($file);
break;
Title: Re: Resize Attached Images
Post by: Kays on January 14, 2010, 10:47:25 PM
It was done like that intentionally.

The idea behind this mod was to save server space. The file size of a .gif file is pretty large to start with. Animated .gifs are much larger. So if you do not wish to convert .gifs, then what you did is probably the best way to do it.
Title: Re: Resize Attached Images
Post by: Croco on February 22, 2010, 11:27:05 PM
I tried the mod and somehow the images on the page were deleted.

Any idea about what went wrong?

SMF2.0 RC2 + highslide mod

the size of images was updated. But the full sized image after resize are gone. It seems it deleted it updated the information and didn't create the new resized images.
Title: Re: Resize Attached Images
Post by: Croco on February 22, 2010, 11:49:31 PM
action=dlattach;topic=22924.0;attach=25237

There is this file

25237_The_Mother_LoloMrs_Juli_JPG5e05d5ff28a9a85777b1678110e6de53

It seems the file still exist but the new action=dlattach;topic=22924.0;attach=25237 is pointing to file that doesn't exist.

What should be the result file after resize?
Title: Re: Resize Attached Images
Post by: Kays on February 23, 2010, 12:18:59 AM
There does seem to be a problem with the mod if the file names were previously encrypted. I'm looking into it and hope to have a solution soon..
Title: Re: Resize Attached Images
Post by: Goad on February 23, 2010, 10:35:10 AM
this mod just corrupted all my attachments on my site.  >:( >:( >:( >:( >:( >:( >:( >:(
Title: Re: Resize Attached Images
Post by: Kays on February 23, 2010, 11:16:35 AM
Can you please be more specific and state what happened.
Title: Re: Resize Attached Images
Post by: Goad on February 23, 2010, 11:32:04 AM
all my images are 404'd now. the thumbnails are there, but when you click on them, the enlarged image is 404'd (missing)

and attached is what one of them look like if i rename it to a .jpg

Title: Re: Resize Attached Images
Post by: Arantor on February 23, 2010, 11:33:21 AM
Did you move them with FileZilla?
Title: Re: Resize Attached Images
Post by: Goad on February 23, 2010, 11:38:12 AM
i recently moved servers, but i tar'd the site and moved it via filezilla, then extracted it.

so in short, no. but the file i just attached was downloaded via filezilla.....why?
Title: Re: Resize Attached Images
Post by: Kays on February 23, 2010, 12:04:13 PM
Set the transfer type to binary, re-download it and check again.

There is a problem currently with old encrypted file names like yours when the file extension is uppercase. I am looking into that.
Title: Re: Resize Attached Images
Post by: Goad on February 23, 2010, 12:10:19 PM
ok, tried the 'binary' download. that worked.

so what can i do to get my broken attachments working again? or is everything hosed?

I have just under 10,000 attachments :(
Title: Re: Resize Attached Images
Post by: Kays on February 23, 2010, 12:38:31 PM
Your attachments should be fine then.

Were the attachments working correctly after the move and before you applied the mod?
Title: Re: Resize Attached Images
Post by: Goad on February 23, 2010, 12:48:50 PM
Quote from: Kays on February 23, 2010, 12:38:31 PM
Your attachments should be fine then.

Were the attachments working correctly after the move and before you applied the mod?

I upgraded to 1.1.11 then shortly after I installed this mod. A few weeks later I moved to the new server and now (a few more weeks later) I am noticing all my attachments that were there previous to installing the mod are 404'd.

The old site is still there and the same images are 404'd on the old site as well as the new site.

I did notice that if there are no capital letters in the image name, it is fine. I saw you mentioned something about that.
Title: Re: Resize Attached Images
Post by: Kays on February 23, 2010, 02:38:56 PM
You can still see the images, so all is not lost.

Let me take a look into it.
Title: Re: Resize Attached Images
Post by: Goad on February 24, 2010, 09:22:29 AM
i know they arent lost...just something is being case sensitive in some way.

please let me know what your fix is ASAP. thank you.
Title: Re: Resize Attached Images
Post by: Goad on February 26, 2010, 10:31:10 PM
any updates to fix the above noted issue?
Title: Re: Resize Attached Images
Post by: Kays on February 28, 2010, 10:29:04 AM
Sorry about the delay. It took me a while to replicated the problem. Since it only affect files using the older encryption method.

I've incorporated a fix into the mod which will attempt to correct the file name. Since that's what didn't get changed. If it's still unable to find an image it will log an error. It has been tested for 2.0 but not for 1.1 yet.

Please uninstall any old version of the mod and install V1.4.

If you were not using encrypted file names previously then there is no reason to update the mod
Title: Re: Resize Attached Images
Post by: Goad on March 01, 2010, 11:00:41 AM
that appears to have fixed it...thank you!
Title: Re: Resize Attached Images
Post by: Kays on March 01, 2010, 11:15:01 AM
Glad to hear that. :)
Title: Re: Resize Attached Images
Post by: drewid65 on March 02, 2010, 08:22:19 AM
I've registered here just to say thank you for this mod.  Great job and thanks for the continued support.
Title: Re: Resize Attached Images
Post by: Kays on March 02, 2010, 09:31:53 AM
Thank you very much. :)

And welcome to SMF.
Title: Re: Resize Attached Images
Post by: lala1 on March 15, 2010, 04:26:26 PM
before I jump on the RC3 bandwagon: is this mod compatible with RC3 or should I wait until a new version is released?

thanks,
lala
Title: Re: Resize Attached Images
Post by: Kays on March 15, 2010, 07:28:40 PM
It does work for RC3. I've updated the installer but didn't change the version number as there were no changes required
Title: Re: Resize Attached Images
Post by: lala1 on March 17, 2010, 05:47:23 PM
Thanks for info!

I still have to wait for highslide, though...
Title: Re: Resize Attached Images
Post by: Xavi-Nena on March 23, 2010, 01:14:55 AM
I uploaded this mod however i see no difference. Is there a place i should see an area to admin it?
Title: Re: Resize Attached Images
Post by: Kays on March 23, 2010, 01:21:26 AM
There are no controls for it. Just ensure that you do have a size set for posted images in Features and Options.
Title: Re: Resize Attached Images
Post by: Xavi-Nena on March 23, 2010, 01:49:59 AM
awesome thanks that worked...and now i can uncheck resize to thumbnail size under post so it does not duplicate the image and saves storage space...thanks so much! :)
Title: Re: Resize Attached Images
Post by: Kays on March 23, 2010, 09:33:11 AM
Good, glad that worked for you. :)
Title: Re: Resize Attached Images
Post by: Makar on April 06, 2010, 01:41:23 AM
Question Kays

I installed Resize Attached Images 1.4

Now, when I add an attachment  : original -  jpeg  2048 х 1536  548 кб

changes the size 800 х 600 <206 kb  (Max width of posted pictures / Max height of posted pictures / Max size per attachment )

in viewing the file shows the size of 800 x 600 71 kb

but when I do Attachment Integrity Check

I get an error - 1 attachments/avatars are being reported as the wrong filesize

click to fix and get

All selected errors have now been corrected

but in the end the image size is 701 kb

how to fix?


Quote from: lala1 on March 17, 2010, 05:47:23 PM
Thanks for info!

I still have to wait for highslide, though...

Look at - Highslide Image Viewer (http://custom.simplemachines.org/mods/index.php?mod=1450) 

mod works with Resize attachments




Title: Re: Resize Attached Images
Post by: Kays on April 06, 2010, 09:30:47 AM
For which version SMF?
Title: Re: Resize Attached Images
Post by: Makar on April 06, 2010, 04:07:02 PM
2.0 rc3
Title: Re: Resize Attached Images
Post by: Kays on April 07, 2010, 01:17:50 AM
It looks like it's saving the file as a png instead jpg.

Just need to figure out why. It looks like there have been a number of changes made in how attachments are handled.

Title: Re: Resize Attached Images
Post by: Makar on April 07, 2010, 03:25:35 AM
maybe

a clean forum is the same

I uploaded the image through aeva , his normal size as it must be , so gd library works fine

please look at my test forum , address the forum, login and password sent to you in PM
Title: Re: Resize Attached Images
Post by: Kays on April 07, 2010, 09:44:55 AM
It only happens with new images. From what I can see so far is that it does get resized to a jpeg. But after that it get's changed to a .png. If I resize the .png as an existing image it will resize as a jpeg this time.

One temporary solution until i find a fix. In Post.php look for the following and either comment it out or remove it.


// Added for the Image resize mod
if(list ($width, $height, $type) = @getimagesize($_FILES['attachment']['tmp_name'][$n]))
{
if($type != 'IMAGETYPE_JPEG' || $width > $modSettings['max_image_width'] || $height > $modSettings['max_image_height'])
{
// What size should this image be?
$width = $width > $modSettings['max_image_width'] ? $modSettings['max_image_width'] : $width;
$height = $height > $modSettings['max_image_height'] ? $modSettings['max_image_height'] : $height;

// Resize it
require_once($sourcedir . '/Subs-Graphics.php');
if(saveAsJpeg($_FILES['attachment']['tmp_name'][$n], $width, $height, $_FILES['attachment']['tmp_name'][$n]))
{
// Find the new size.
$_FILES['attachment']['size'][$n] = filesize($_FILES['attachment']['tmp_name'][$n]);

// Change the file name if it's not a .jpg
if(strrchr($_FILES['attachment']['name'][$n], '.') != '.jpg')
$_FILES['attachment']['name'][$n] = substr($_FILES['attachment']['name'][$n], 0, -(strlen(strrchr($_FILES['attachment']['name'][$n], '.')))) . '.jpg';
}
}
}
// End Image resize mod
 

This will resize any images when they are viewed rather than when uploaded.
Title: Re: Resize Attached Images
Post by: Makar on April 07, 2010, 01:27:19 PM
thanks try
I'll write about the results
Title: Re: Resize Attached Images
Post by: hellbent64 on April 07, 2010, 09:07:45 PM
so my forums has been acting buggy for awhile now...  i think ultimate shoutbox buggered something up.
found out today i have 6584 pages of attachment thumbnails and found out its this conflict with highslide and 1.1 of resize.

well i uploaded and ran the clean_thumbs.php and get this error:
Fatal error: Cannot redeclare ssi_shout() (previously declared in D:\Hosting\4508226\html\APforums\SSI.php:1571) in D:\Hosting\4508226\html\APforums\SSI.php on line 1585

i tried uninstalling shoutbox but i still get this error.
i am running
SMF Package SMF 1.1.11

any advice for me?
Title: Re: Resize Attached Images
Post by: Kays on April 07, 2010, 09:38:57 PM
Take a look in SSI.php at those mentioned lines and you'll probably see some code for the shoutbox which is duplicated. Since you have the shoutbox removed, you should be safe to remove all of that code.
Title: Re: Resize Attached Images
Post by: hellbent64 on April 08, 2010, 04:24:13 AM
sorry, i dont know much about php.   i removed the lines and it cleared up about 59000 images!
thanks!
Title: Re: Resize Attached Images
Post by: Makar on April 08, 2010, 01:20:41 PM
Quote from: Kays on April 07, 2010, 09:44:55 AM
One temporary solution until i find a fix..................

as a temporary solution came
but
had to increase the limit from 206 kb to 1024kb for one picture
otherwise the image is larger than 206kb does not load and resize

Sorry for my english
Title: Re: Resize Attached Images
Post by: hotrod007 on April 20, 2010, 07:44:34 AM
I'm Getting this Error on a couple pages.  SMF 1.1.11

http://njsaltwaterfisherman.com/forums/index.php?topic=15031.160

Database Error
You 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 Custom Plugs.jpg'
WHERE ID_ATTACH = 26752
LIMIT 1' at line 2
File: /var/www/vhosts/njsaltwaterfisherman.com/httpdocs/forums/Sources/Display.php
Line: 1229

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


Also my error log is filled with Errors.. like this.


Apply Filter: Only show the errors with the same message
Attachment not found: /var/www/vhosts/njsaltwaterfisherman.com/httpdocs/forums/attachments/27483_ad8364f6c47f6ed32ee3cf87817d1e762a63d6b3


Apply Filter: Only show the errors with the same message
2: imagejpeg() [<a href='function.imagejpeg'>function.imagejpeg</a>]: Unable to open '/var/www/vhosts/njsaltwaterfisherman.com/httpdocs/forums/attachments/14237_SGtogSP10707_jpg41e51d95dde49d647d2eb03e69ba5718' for writing
File: /var/www/vhosts/njsaltwaterfisherman.com/httpdocs/forums/Sources/Subs-Graphics.php
Line: 1732



I am Afraid what will happen if I uninstall this mode now... :-[
Title: Re: Resize Attached Images
Post by: Kays on April 20, 2010, 09:12:26 AM
Removing the mod might or might not get rid of that error. It looks like that file is missing in the attachments folder.

In the Admin CP > Attachments and Avatars > File Maintenance. At the end of this line Total Size of Attachment Directory is a [Maintain] link. Click on that and run any suggested tasks.

Also, it appears that your database is way outdated. Download the large upgrade package, extract the upgrade.php and the .sql files and upload them to the root of your forums. Then run upgrade.php. Do backup your database first before doing so.
Title: Re: Resize Attached Images
Post by: hotrod007 on April 20, 2010, 09:47:33 AM
I did as you said.  but the Script to maintain has been running for the last 15 minutes..

Not done yet!
To avoid overloading your server, the process has been temporarily paused. It should automatically continue in a few seconds. If it doesn't, please click continue below.

I never had the data base error before..  Do we think the resizer is what caused it because of the old version?

I never updated the data base version.. didn't know I needed to..

I love this mode. I hope I get get this worked out.

I'm afraid of these updates.. always worried I'm going to lose something..

Where do I find the update script..



Edit.  I removed the Mod.  and everything is back to norm..  I would like to try and the the update and then reinstall it.  Maybe it will then run right?
Title: Re: Resize Attached Images
Post by: Kays on April 20, 2010, 10:09:19 AM
It might take a little while to run but not that long I would think.

Since 1.1.1 there have been several changes made to the database. Some of it to do with attachments. But the mod should work fine on older versions.

As for updating, you can download the large  upgrade package from here (http://www.simplemachines.org/download). All that's required from it are the upgrade.php and the .sql files. I think there's two of them.

Do backup your database first. (How do I backup my database? (http://docs.simplemachines.org/index.php?topic=492.0))
Title: Re: Resize Attached Images
Post by: hotrod007 on April 20, 2010, 10:19:30 AM
Thanks Kays for your help..  My Host is backing up everything.  I'll run the update tonight.. then reinstall and see what happens.. I love this Mod. I hope I can get it to work.

So When I did the automatic updating from my old version.  This PHP File wasn't included..?

Title: Re: Resize Attached Images
Post by: Kays on April 20, 2010, 10:48:35 AM
When an auto update is run the database upgrade should be a part of the process. But it looks like that got skipped in your case.

Did that maintenance routine finally finish running?
Title: Re: Resize Attached Images
Post by: hotrod007 on April 20, 2010, 11:57:55 AM
No  I ran it again after removing the Mod.  and it still hung for 10 minutes..

Updates scare me :P
Title: Re: Resize Attached Images
Post by: Kays on April 20, 2010, 12:02:48 PM
Without the mod, are you still getting those errors now?
Title: Re: Resize Attached Images
Post by: hotrod007 on April 20, 2010, 01:00:08 PM
NO All cleaned up.  that link I post with that Error.   The post was actually missing. and the images.
when I removed the mod.  the post and images came back and all errors are gone now.

I really need this Mod.  My members aren't very good at resizing.. :o
Title: Re: Resize Attached Images
Post by: Kays on April 23, 2010, 11:13:19 PM
Hi, sorry about the delay. I've updated it for 1.x and hopefully this should correct you problems.



Updated for 2.0 RC3

Due to a number of problem with attachments in 2.0 RC3 and the changes I have done a major rewrite of the mod and updated to to address a numbers of problems associated with image files. Some of the fixes include.

- White screen of death when uploading larger files
- Reencoded images now preserve the file format.
- Disabled duplicate file name checking.
-  Added a warning message if GD is not available.
- Better support for bitmap images.

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
- The ability to set the jpeg compression factor.
- The option to save thumbnail either as .jgp or .png. independent of the avatar setting.
- Change existing  .png images back to .jpg.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: hotrod007 on April 23, 2010, 11:43:22 PM
Cool Kay..  this may correct My? Problem..  I'm afraid to do the Database update.. :-\
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Bugo on April 24, 2010, 02:25:15 AM
Russian translation (look at attachments) for ANSI & UTF-8 charsets.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Spuds on May 05, 2010, 12:26:22 PM
Kays,

Awesome mod, just what I needed with users that rather upload a large image and let the forum do the resize work, those 10 megapixel cameras and fast internet access have really change the way people interact with forums and this mod is needed.

While doing some testing (RC3) I uploaded a large image, 2592x1944 about 2.2M, and had the admin settings of max width and max height set to 1024.   When the file uploaded it was resized but to 1365x1024 (and now 200K sweet).  Anyway I was surprised by the 1365 dimension since I had set a max to 1024.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Kays on May 07, 2010, 11:23:14 PM
Hi Spuds. thanks for that. It looks like there was a problem with the script. I've corrected that

Thanks for the translation Bugo. It has been added.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: TomW on May 09, 2010, 09:23:23 AM
I would really like to use this mod, but I have a code conflict with SMF Gallery Pro mod.  Subs-Gallery.php, with SMF Gallery Pro, has this code snippet

// Save it!

// SMF Gallery
if (empty($modSettings['gallery_jpeg_compression']))
$modSettings['gallery_jpeg_compression'] = 65;

if (!empty($modSettings['avatar_download_png']))
imagepng($dst_img, $destName);
else
imagejpeg($dst_img, $destName, $modSettings['gallery_jpeg_compression']);


I'm not experienced enough with php to know how to make this work along with your mod.  Can anyone help ?
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Kays on May 09, 2010, 09:50:36 AM
Hi, replace that code with the code from the mod. When you do that you'll have to set the compression factor in the The Attachments settings rather than in the Gallery CP.


// Save it!
if (!empty($modSettings['attachment_thumb_png']) || (!empty($modSettings['avatar_download_png']) && !empty($modSettings['new_avatar_data'])))
imagepng($dst_img, $destName);
elseif (empty($modSettings['attachment_image_reformat']) && isset($modSettings['image_format']) && $modSettings['image_format'] != 'jpeg' && $modSettings['image_format'] != 'bmp')
{
$image = 'image' . $modSettings['image_format'];
$image($dst_img, $destName);
}
else
imagejpeg($dst_img, $destName, min($modSettings['attachment_image_compression'], 100));
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: TomW on May 10, 2010, 09:00:46 PM
Thanks, it is working - somewhat.  Now I am seeing a vertical scrollbar.  No matter how tall the image, I have one. What's up with that ?  (using SMF 2.0 RC3)
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Kays on May 11, 2010, 10:18:09 AM
That is probably in the CSS. Does it do it using the default theme? Which browser?

Look in index.css for oveflow in .inner or .post. If it's set to scroll, change it to auto.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: TomW on May 11, 2010, 09:10:46 PM
Quote from: Kays on May 11, 2010, 10:18:09 AM
That is probably in the CSS. Does it do it using the default theme? Which browser?

Look in index.css for oveflow in .inner or .post. If it's set to scroll, change it to auto.

I am using the default theme, Safari 4.0.5 on a mac.  If I use Firefox, there is no scrolling.  However there are enough mac users on my forum that I'd like to see this resolved.

index.css does not have 'overflow'.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Kays on May 12, 2010, 09:05:07 AM
That's a problem with your browser not with the mod.

I would suggest you post this in the Graphics and Templates (http://www.simplemachines.org/community/index.php?board=34.0) board.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: TomW on May 12, 2010, 10:27:43 AM
Kays, thank you.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: TomW on May 29, 2010, 12:59:16 AM
No help there; in fact my post was deleted.  Understood, since it is not really a defect with the mod.  I looked at index.css (default theme) and don't see 'scroll' anywhere.  I also made a few edits to it, to no avail.  Can anyone help me with this ?
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: forumnepali on June 03, 2010, 04:31:43 PM
hi i have just install this modnow i'am getting 500 internal Error when i posting sone Image in post.

if you need ani Error logs please let me know i will provide you.

Thanks
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: computerworks on June 07, 2010, 04:34:32 PM
Installed Mod (1.5) on SMF 1.1.11

Users started reporting topics with MySQL errors

Quote
Database Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '67_GT500__3168.jpg'
WHERE ID_ATTACH = 10080
LIMIT 1' at line 2
File: /home/.../myservername/html/Sources/Display.php
Line: 1228

It seems that when the file name of the attachment has a single-quote, or apostrophe, it causes that error...and stops the post from being displayed.

Uninstalled the mod, deleted attachment and renamed file without apostrophe in the name, reattached...all OK. The post now displays....and stays good when mod is reinstalled.

Can this be addressed

Thanks for a great mod.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: computerworks on June 08, 2010, 09:06:33 AM
(con't...watching error logs more closely)

Further, some older topics with small attachments...when viewed..now have all black image thumbs.

And for those topics, there is the following errors in the log:

Quote
2: imagedestroy(): supplied argument is not a valid Image resource
File: /home/.../myservername/html/Sources/Subs-Graphics.php
Line: 1733

2: imagecopyresampled(): supplied argument is not a valid Image resource
File: /home/.../myservername/html/Sources/Subs-Graphics.php
Line: 1724
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: jaisi on June 11, 2010, 05:14:57 PM
hi guys i have just uninstall this mod but stil showing this Error

Webpage error details i'am useing Ie 8

Message: 'ImageResizer' is undefined
Line: 878
Char: 1
Code: 0
URI: http://Homepage.com/index.php?action=forum

Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: avf on June 27, 2010, 12:48:42 PM
This is my most fav mod. I had a problem earlier which was solved superbly. I noticed a new error lately which I hope the mod writer will be able to help me with.

I am getting thousands of errors stating Division by zero" error

2: Division by zero
File: /home/xxxxxx/public_html/forum/Sources/Subs-Graphics.php
Line: 1694

my file is attached. I have tried to see about the error in the forum but it seems members are getting this in various diff files. My version is SMF 1.1.11

I would appreciate help on this error.
Thanks
Sunil
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: computerworks on June 28, 2010, 09:54:53 AM
Quote from: computerworks on June 07, 2010, 04:34:32 PM
It seems that when the file name of the attachment has a single-quote, or apostrophe, it causes that error...and stops the post from being displayed.


Still looking for some advice on this error.

Shouldn't apostrophes in the attachment name be parsed out? It seems to be so without the mod installed.

Any advice is appreciated.

Altho we advised users not to have apostrophes in attachment filenames, someone always ignores it.
We then have to uninstall the mod, delete the attachment, and reinstall the mod.
PITA :-)
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: TomW on June 29, 2010, 06:37:18 PM
Quote from: computerworks on June 28, 2010, 09:54:53 AM
Quote from: computerworks on June 07, 2010, 04:34:32 PM
It seems that when the file name of the attachment has a single-quote, or apostrophe, it causes that error...and stops the post from being displayed.


Still looking for some advice on this error.

Shouldn't apostrophes in the attachment name be parsed out? It seems to be so without the mod installed.

Any advice is appreciated.

Altho we advised users not to have apostrophes in attachment filenames, someone always ignores it.
We then have to uninstall the mod, delete the attachment, and reinstall the mod.
PITA :-)

You don't have to uninstall the mod & reinstall.  Simply delete the attachment.  You can also copy the attachment to your computer, then remove the attachment from the server, then modify the post.  Not as difficult, but it is still a PITA. 

I'd like to see this issue corrected also.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: computerworks on July 13, 2010, 01:43:57 PM
QuoteYou don't have to uninstall the mod & reinstall.  Simply delete the attachment.

Problem is... the DB error obscures the offending post, so you can't edit it. Only way to see the post and its attachments is to uninstall.

Unless ANYONE can provide an idea or a direction for us to fix this problem (parsing out apostrophes from the attached file name)...

...we are forced to dump this Mod in the trashcan.

No matter how many warnings we post for users NOT to use filenames with apostrophes in them... eventually someone ignores the warning and screws up another thread.

Great mod idea... almost a necessity today (autoresizing pictures)...but this bug is a deal-killer and makes it unusable.

Thanks
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Kays on July 14, 2010, 12:51:40 PM
Sorry about the delay.

It looks like the apostrophe problem is with SMF 1.1 and not the mod. Anything before an apostrophe will not show. Works fine with 2.0

I've been checking the code and so far have not figured out why this is happening yet.

Quote from: jaisi on June 11, 2010, 05:14:57 PM
hi guys i have just uninstall this mod but stil showing this Error

Webpage error details i'am useing Ie 8

Message: 'ImageResizer' is undefined
Line: 878
Char: 1
Code: 0
URI: http://Homepage.com/index.php?action=forum

This error is from another mod.

Quote from: avf on June 27, 2010, 12:48:42 PM
This is my most fav mod. I had a problem earlier which was solved superbly. I noticed a new error lately which I hope the mod writer will be able to help me with.

I am getting thousands of errors stating Division by zero" error

2: Division by zero
File: /home/xxxxxx/public_html/forum/Sources/Subs-Graphics.php
Line: 1694

my file is attached. I have tried to see about the error in the forum but it seems members are getting this in various diff files. My version is SMF 1.1.11

I would appreciate help on this error.
Thanks
Sunil

This has been corrected some time ago. Update to Version 1.5.

Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: TomW on July 19, 2010, 10:40:30 AM
Quote from: computerworks on July 13, 2010, 01:43:57 PM
QuoteYou don't have to uninstall the mod & reinstall.  Simply delete the attachment.

Problem is... the DB error obscures the offending post, so you can't edit it. Only way to see the post and its attachments is to uninstall.


That is true, but you can determine the thread, and the approximate date by the previous post.  Then, go to your admin - attachments - browse files, and sort by date.  You may have to scroll thru a few pages, but you can usually find the 'offending' attachment.  No, this is not a solution, but an easier workaround to removing & re-installing the mod.

I believe that SMF Gallery has the logic to check for the characters in the file name.  There may be other mods also which have the code.   I'm just not proficient enough with php to make the change myself.  In other words, this is a fixable problem with the mod.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: computerworks on July 19, 2010, 11:47:44 AM
Quote from: TomW on July 19, 2010, 10:40:30 AM
That is true, but you can determine the thread, and the approximate date by the previous post.  Then, go to your admin - attachments - browse files, and sort by date.

Thanks, Tom...yes, that sure will work better than uninstall/reinstall.

I never used that Admin feature...thanks for the point-to.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: fotis3d on October 09, 2010, 04:05:01 AM
Hi there. I've installed this mod and it seems to work fine.
But i can't find anywhere a menu with the settings.
How am i supposed to set width, height and compression ?

I use Version 1.1.11 with a custom template but even on default theme i can't find it anywhere.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Makar on October 09, 2010, 07:50:54 AM
Configuration settings are taken from the attached settings
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Kays on October 09, 2010, 08:26:10 AM
There are no admin controls for 1.1.x. The compression is set at 85 and the image size is the same as for linked images under Features and Options in the Admin CP.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: fotis3d on October 09, 2010, 02:53:13 PM
Then unfortunately this mod doesn't work for me since i want the linked at 750px and the attached at let's say 1280px.
And also i needed to be able to change the compression (of course i believe this could be done through coding )

too bad

:-[
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: fotis3d on October 26, 2010, 02:05:15 PM
Is there a way to change the compression setting for smf 1.1.11 ?

Edit: Nevermind i got it  ;)

But is there a way of changing the code so that it won't get the size from smf but just put the wanted numbers in the code ?
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Glasso on October 31, 2010, 02:45:18 AM
Superb mod, thank you!
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: wickedgood on November 04, 2010, 06:00:20 PM
Anything for RC4?
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: dmacleo on November 15, 2010, 12:29:44 PM
yeah I liked this on rc3, tried install on rc4 and it failed for me.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: spinus on November 16, 2010, 08:47:57 AM
Hope to see it for RC4. Thanks.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: fiver on November 17, 2010, 06:24:57 AM
SMF 2.0 RC 3


I installed this many months ago, and during installation I selected
- Reformat non-JPEG images to JPEG
- Resize existing images
After installation, all the images before installation only shows thumbnails. When clicked, it shows a browser empty image icon.


I deselected these 2 settings and it didn't revert or repair the damaged attachments. How do I get the hundreds of old attachments back please?




Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Glasso on January 17, 2011, 11:49:09 PM
Waiting for RC4 update  :-[
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Kays on January 18, 2011, 09:59:12 PM
Updated for 2.0 RC4
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: Glasso on January 19, 2011, 01:31:08 AM
Quote from: Kays on January 18, 2011, 09:59:12 PM
Updated for 2.0 RC4

Thank you, you are great! Just installed.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: willerby on January 19, 2011, 02:36:03 PM
I don't know how I have missed this mod but have been searching for a simple image upload mod for two years. I've used everything offered for external hosting services because my users are all non-techie types who try and upload 5Mb digital images and can't get the hang of reducing photos despite step by step instructions in a variety of ways. But all the external mods either failed, required the user to cut and past links etc or got dropped by the mod authors.

This is one awesome mod. Installed on RC4, tested, resized existing images and love it. Have been able to remove all restrictions on image file size and dimensions for attachments and now users have no excuse.

Thank you Kays... elegant and simple, and most importantly it does what it says...
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on January 19, 2011, 07:27:41 PM
You're welcome laetabi. :)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: fiver on January 22, 2011, 09:10:34 AM
Hi Kay,


Could you take a look at reply #128 pls. Thanks.
http://www.simplemachines.org/community/index.php?topic=342947.msg2853183#msg2853183
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on January 22, 2011, 09:47:17 AM
Are the original images still on the server? Look at the dlattach number for that image. Then check the database for it and the attachment folder. All attachments are now named with the id number as the first digits before the underscore. Followed by the file_hash.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: spinus on January 27, 2011, 09:14:16 AM
Quote from: Kays on January 18, 2011, 09:59:12 PM
Updated for 2.0 RC4
Thank you very much!  ::)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Spuds on January 27, 2011, 11:58:04 PM
@Kays

Noticed a small issue on RC4 whith the modification in Subs-Post.php, where you add in the section of // Did the mime type change during reencoding?

Part of the added code uses $validImageTypes (in case getimagesize does not return a valid image mime) but $validImageTypes is not initiated until after that point in the code.

Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on January 28, 2011, 12:46:23 PM
Thanks for noticing that Spuds. It looks like the devs moved a few things around and I missed it. ::)

I've changed the search position to be after $validImageTypes is initialised and updated the mod. You will need to uninstall the old version first.

@ spinus, your welcome. :)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: TomW on January 30, 2011, 11:28:13 AM
Thanks for the update, and for changing the file naming logic !
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: aw06 on February 12, 2011, 02:24:54 PM
Quote from: Kays on October 17, 2009, 04:19:10 PM
V2.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
- The ability to set the jpeg compression factor.
- The option to save thumbnail either as .jgp or .png. independent of the avatar setting.
- Change existing  .png images back to .jpg.

Not possible to get these features on 1.1.13 ??
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on February 13, 2011, 12:30:50 PM
It would require a bit of a re-write. Something which I'm not into. Adding the admin control panel is a lot simpler for 2.0 than it is for 1.1.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: kizer on February 25, 2011, 05:17:18 PM
Is there an update for 2.0 RC 5 coming anytime in the future. ;)

Please and thank you
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: kizer on February 25, 2011, 05:20:15 PM
I installed it in 2.0 RC 5 and this is what I get when I look at any of my Mod settings in the admin panel. It shows up in the header and it looks like some of my Div tags are wacked out because some of my settings appear to be shifted or simply look to have been erased. LOL


// Added for resize attached images mod 2.0. $helptxt['attachment_image_compression'] = 'This sets the JPEF quality factor. A higher number increases image quality but also increase the file size. '; $helptxt['attachment_resize_existing'] = 'Selecting this option will resize any existing images which are larger than the set dimensions for attached images.'; $helptxt['attachment_image_reformat'] = 'Selecting this option will reformat any non-JPEG images into the JPEG format';
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on February 25, 2011, 05:27:46 PM
Take a look in Help.english.php and make sure that the added lines are before the ?>.

The last line on the page should be ?> with no blank lines after it.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: kizer on February 25, 2011, 05:30:02 PM
Ah Hah, I figured it out. Some reason it wrote

// Added for resize attached images mod 2.0.
$txt['attachment_image_width'] = 'Maximum width of attached images.<div class="smalltext">(0 for no maximum width)</div>';
$txt['attachment_image_height'] = 'Maximum height of attached images.<div class="smalltext">(0 for no maximum height)</div>';
$txt['attachment_image_compression'] = 'JPEG quality factor<div class="smalltext">(Maximum 100, default 75)</div>';
$txt['attachment_resize_existing'] = 'Resize existing images';
$txt['attachment_image_reformat'] = 'Reformat non-JPEG images to JPEG.';
$txt['attachment_thumb_png'] = 'Save thumbnails as PNG.';
$txt['attachment_gd_warning'] = 'The GD module is currently not installed. The following image resize functions can not be performed.';


In Help.english.php at the very bottom out of the >? tag. Not sure why it needed it at all so I deleted it and that header doesn't seem to be showing up in the Admin panel any more.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: kizer on February 25, 2011, 05:31:41 PM
Funny you replied at the same time I was figuring it out. Thanks for the help even thou I kinda figured it out at the same time. I at least hope it does help somebody else if they have the same problem. ;)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on February 25, 2011, 05:39:30 PM
Cool, it used to be a common problem at one time and this is the first I've seen it for quite some time. It's due to the way the search for "end" works

So, whenever editing files, do make sure that there's no blank lines at the end after the ?>
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: hellbent64 on July 30, 2011, 04:17:04 PM
any chance of this mod being updated for 2.0 gold?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: hellbent64 on August 15, 2011, 02:57:02 PM
:bump:
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Glasso on August 15, 2011, 03:47:20 PM
This works for 2.0 gold - try emulation when installing the package
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: hellbent64 on August 15, 2011, 04:25:16 PM
worked, thanks!
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: hellbent64 on August 17, 2011, 04:02:29 AM
nm, it installed, but isnt resizing attachments.
yes, its enabled.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Glasso on August 17, 2011, 02:02:33 PM
Are the Maximum width and height of attached images set to some reasonable numbers? I have 800 for both and it works perfect on 2.0
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: hellbent64 on August 17, 2011, 02:26:11 PM
thank you glasso, my max width and height were not set.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: perestroika on October 03, 2011, 07:01:37 AM
Hi there!

Please give me an advice how to solve the following problem.

The mod works well except on some pages on specific topics where the resulting page is totally blank. (Example: http://chaimai.com/index.php?topic=3813.320 but http://chaimai.com/index.php?topic=3813 works!) These pages contain attached images. No errors in the SMF error log nor in the PHP error log. No DB debug messages shows. I've tried to write the following code into index.php error_reporting(E_ALL);
ini_set('display_errors', '1');
but nothing is displayed.

It worked before applying the mod. If I uncheck "Show images below posts" in the settings, everything works again but of course it wont display any images. I use the Resize Attached Images mod in conjunction with "Enable the Highslide 4 SMF Modification", turning it of doesn't change anything.

I've totally ran out of ideas how to debug the problem. Any ideas?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on October 03, 2011, 09:26:11 AM
Hi, that is a bit strange. ???

Can you see those images if you go into the Admin CP and browse those files?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: perestroika on October 03, 2011, 03:19:34 PM
Quote from: Kays on October 03, 2011, 09:26:11 AM
Hi, that is a bit strange. ???

Can you see those images if you go into the Admin CP and browse those files?

Hi Kays!
Sure I can. And as I wrote, if I uncheck "Show images below posts" in the settings, the page http:chaimai.com/index.php?topic=3813.320 will show up (without the images though...)and I can click the links to download/see the images. I'm confused  :P I wish I could see an error message at least. I'm not sure any longer that the problem is caused by this mod. Anyway I will keep you updated. Thanks!  ;D
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on October 03, 2011, 03:53:32 PM
It sounds like it could be a problem with the thumbnails. Is there anything special or unique about these images?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: perestroika on October 04, 2011, 05:52:07 AM
Quote from: Kays on October 03, 2011, 03:53:32 PM
It sounds like it could be a problem with the thumbnails. Is there anything special or unique about these images?

Hi there!

I did migrate from one host to another moving all files with Filezilla. I did not know then that i had to set Filezilla to transfer files without a file extension (eg .jpg) as binary files and after moving the site that was 2.0 RC4 everything worked. I still have that 2.0 RC4-site so I can check it. I then made a copy of the RC4 - site and upgraded it to 2.0.1.

I,ve tried to use a different template and it makes no difference. I also replaced all the source code temporary and those specific pages are still blank. I figure it could be some problem with the attachments but why are the same files working in 2.0.4 then.... I still havent figured out how to debug this problem... Maybe I can transfer the attachments again, this time as binary files and see what happens. I guess there's a problem that the mod has resized a lot of those images and if  I overwrite them with the originals the info in the DB would be wrong (like sizes etc) maybe leading to more problems....  ???
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on October 04, 2011, 11:41:52 AM
Quote
I did migrate from one host to another moving all files with Filezilla. I did not know then that i had to set Filezilla to transfer files without a file extension (eg .jpg) as binary files and after moving the site that was 2.0 RC4 everything worked.

If that's the case, that could be the problem. Try adding an extension to a file from your backup and see if it's viewable as an image. If that's the case you should be able to just re-upload them as binary this time.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: perestroika on October 04, 2011, 12:26:06 PM
Quote from: Kays on October 04, 2011, 11:41:52 AM
Quote
I did migrate from one host to another moving all files with Filezilla. I did not know then that i had to set Filezilla to transfer files without a file extension (eg .jpg) as binary files and after moving the site that was 2.0 RC4 everything worked.

If that's the case, that could be the problem. Try adding an extension to a file from your backup and see if it's viewable as an image. If that's the case you should be able to just re-upload them as binary this time.

I did however select binary as the default transfer type before transferring the files to the server but i didn't uncheck the "Treat files without extension as ASCII file". If I transfer files from the web server back to my PC they all seem viewable on my PC so I'm not sure that's my problem. Besides my problem may be isolated to a single topic, that is, I haven't found the same problem in other threads. It might just be a coincidense that the "problem topic" is full of images. The problem i experience could actually be any kind of problem with SMS or maybe corrupt data in DB. Who knows  ::) I think I will experiment a bit with splitting the topic into several and back again... If nothing else helps I will have to just delete that topic and hope it´s only one topic that's affected. Thanks Kay, You have been more than helpful!
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on October 04, 2011, 01:30:43 PM
Can you open one of the problem files to view it. If so, Maybe it's just the thumbnails which are corrupt.

One thing you could try in this case, is to change the size of the thumbnails. Then all thumbnails will be recreated on the fly as they are viewed.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: perestroika on October 04, 2011, 04:17:14 PM
Quote from: Kays on October 04, 2011, 01:30:43 PM
Can you open one of the problem files to view it. If so, Maybe it's just the thumbnails which are corrupt.

One thing you could try in this case, is to change the size of the thumbnails. Then all thumbnails will be recreated on the fly as they are viewed.

Hi Kays!

Changing thumbnail size doesn't solve the problem.

By not displaying thumbnails i can see the faulty postings and I've isolated one for testing. It is indeed a posting with an image attached. I've found the attachment in the DB.

id_attach id_thumb id_msg id_member attachment_type filename size downloads width height file_hash fileext mime_type id_folder approved
10102 10103 52192 0 0 Thailand juni-juli 2011 071.jpg 2729415 1 4000 3000 XXXX7943a41b3d65e88812e24b2aaab3f84c9219 jpg image/jpeg 1 1
10103 0 52192 0 3 Thailand juni-juli 2011 071.jpg_thumb 436971 0 640 480 XXXXa9cfdd705d31a215afb41fbc4cab95e64040 jpg image/png 1 1


Further I've found them in the attachments folder.
There is actually 3 files, all the same size (2729415 bytes)
10102_XXXX7943a41b3d65e88812e24b2aaab3f84c9219
10102_XXXX7943a41b3d65e88812e24b2aaab3f84c9219.temp
10102_XXXX7943a41b3d65e88812e24b2aaab3f84c9219_thumb.tmp


And the thumbnail
10103_XXXXa9cfdd705d31a215afb41fbc4cab95e64040

I can open all the files if i transfer them to my pc.
If I delete the temp files one of them is recreated, but it still doesn't solve the problem. Still a WSOD blank page.

I attach the photo here that caused the problem. I think I'm getting closer to a solution.  ;)


Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: perestroika on October 05, 2011, 04:56:25 AM
Hello again.
The problem I described in previous postings is indeed not a problem with the mod. It's a Memory limit error resizing large attachments. The problem is a combination of SMF 2.0.1 and my Host provider limiting the memory php uses to 64MB.

Everything is described here (They say it's fixed but it's obviously not)

http://www.simplemachines.org/community/index.php?topic=345724.0
http://dev.simplemachines.org/mantis/view.php?id=4234
http://dev.simplemachines.org/mantis/view.php?id=2229

Thanks Kays for helping me!  :)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on October 05, 2011, 08:58:25 AM
The memory thing has been resolved. When I reported it, it was in the wrong function. It has been moved to the proper function and increased from 90 to something like 120, I think it was.

Any chance of you using a custom php.ini file and increasing the value there?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: perestroika on October 05, 2011, 09:03:45 AM
Memory is limited by the web hosting services company to maximum 64MB.  :'( There is nothing i can do to increase it.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: perestroika on October 05, 2011, 09:41:00 AM
Quote from: perestroika on October 05, 2011, 09:03:45 AM
Memory is limited by the web hosting services company to maximum 64MB.  :'( There is nothing i can do to increase it.

The web hosting company changed the limit to 92 MB (according to phpinfo()). Everything works now!  :) :) :)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on October 05, 2011, 01:44:10 PM
Great, glad you got that resolved. :)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: computerworks on December 01, 2011, 09:25:04 AM
We posted about this issue last year, but have yet to find a solution

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

Frequently, an attached image shows with a thumbnail of a very small file size (8k) and, when clicked, opens to a large totally black image.

Strangely, in posts with several attachments, maybe only one attachment experiences this, while the others are OK.

Using V.1.5 of the Mod, SMF 1.1.11 and the Default template.

Any help would be appreciated...thanks
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on December 02, 2011, 04:53:05 PM
What type of image is it failing on?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: computerworks on December 02, 2011, 05:11:34 PM
JPEGs
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on December 02, 2011, 05:25:44 PM
Are they actually jpegs?

Does this happen to the same file if you re-upload it?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: computerworks on December 02, 2011, 05:28:16 PM
I will track down a user who has a bad attachment as described and will try to re-upload.

(may take a day)

Thanks for following this.  ;)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: computerworks on December 02, 2011, 05:29:53 PM
It might be worth noting that it has been reported to me that resized attachments that have been viewable for several days may suddenly stop expanding and only yield the full black image when clicked.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on December 02, 2011, 05:36:20 PM
Quote from: computerworks on December 02, 2011, 05:28:16 PM
I will track down a user who has a bad attachment as described and will try to re-upload.

If it is just one or a few images, could you attach it here so I can have a look at it?

Quote from: computerworks on December 02, 2011, 05:29:53 PM
It might be worth noting that it has been reported to me that resized attachments that have been viewable for several days may suddenly stop expanding and only yield the full black image when clicked.

It should only get resized once. Are you also using an image display mod like the highslide viewer?

Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: computerworks on December 02, 2011, 05:56:46 PM
Quote from: Kays on December 02, 2011, 05:36:20 PM
If it is just one or a few images, could you attach it here so I can have a look at it?

attached


Quote
It should only get resized once. Are you also using an image display mod like the highslide viewer?

No.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: computerworks on December 02, 2011, 05:57:54 PM
Original image is gone...it was larger in file size and contained correct image.

The attached is how the post's attachment thumbnail now appears.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on December 02, 2011, 06:18:18 PM
There's gotta be something funky about that image if it does it here also. ???

Can you zip it and attach it?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: bwaynef on January 12, 2012, 04:22:58 PM
I uploaded a file that was 840kb and much larger than 800x600 and this mod seemed to resize it fine. 

When I take an image that's straight off the camera, 5+MB, I get:

"An Error Has Occurred!
Your attachment couldn't be saved. This might happen because it took too long to upload or the file is bigger than the server will allow.

Please consult your server administrator for more information. "

php.ini has: "upload_max_filesize = 8M" ,
Max attachment size per post:    6144KB
Max size per attachment:    256KB


Any help here?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on January 12, 2012, 04:52:29 PM
The size of that image is beyond what's set. But that should give you a size exceded error.


Max size per attachment:    256KB


The timeout errors are pretty general. Download the following mod and install it. (it will show an error in Subs-Post.php, which you can ignore). It should provide a better report of what's causing that error.

http://custom.simplemachines.org/mods/index.php?mod=3255
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: bwaynef on January 12, 2012, 05:21:08 PM
I was hoping not to bother you and be able to reply back with the fix w/o you having to be bothered.

I added a php.ini w/ upload_max_filesize & post_max_size @ 8MB, and it works ...at least like I want it to.
Title: Re: Resize Attached Images (Updated for 2.0 RC3 with bug fixes)
Post by: bwaynef on January 12, 2012, 06:07:39 PM
Quote from: fotis3d on October 26, 2010, 02:05:15 PM
Is there a way to change the compression setting for smf 1.1.11 ?

Edit: Nevermind i got it  ;)

I can't for the life of me find this.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on January 12, 2012, 06:15:28 PM
That should be found in the attachment settings.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: bwaynef on January 12, 2012, 06:36:44 PM
Not for 1.1.11 (I know.  I know...)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: bwaynef on January 12, 2012, 07:10:27 PM
likely this line:

imagejpeg($image_resized, $output, 80);

in ./Sources/Subs-Graphics.php
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on January 12, 2012, 07:17:11 PM
Yes, change the 80 to a higher value.

Sorry, I thought that I did add that option to the 1.x version.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: funkythemunky on January 24, 2012, 04:22:21 AM
Just wanted to say THANK YOU for this mod!  :laugh:
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: bdtcomp on April 04, 2012, 09:47:36 AM
I have a problem with uploading images, using the resize application. I parsed it for 2.0.2. At first it appeared to work great. I have it set at 75% compression, the default and picture size of 800 x 800. I also set individual size at 2000 kb, so that any pix above that size is resized, so that they aren't too big.

But I am finding that pix above a certain size such as 4 or 5 megabytes or a combined (I allow 4 images) will upload, but as soon as it reaches 100% it throws a Server Error of HTTP Error 500.0 - Internal Server Error.

I am telling my forum members if they upload small images, it works fine, but if they have a Smart phone image or pix that are up to say 4 megabytes, to only upload one at a time.

The application is better than it was, and people are happy. But I don't know if there is any tweaking I can do. I am on a shared hosting Windows with GoDaddy. If I could move it to a Linux Server would this help? I can't afford anything. I am doing this because I have the hosting, and it is just costing me my time, which is going to have to be curtailed so I can make a living! I don't mind doing things, because this is a self-help weight-loss group that has lost it's company's forum, because she is short of funds and had to curtail the forum, hopefully just temporarily. But my wife and I are in charge of this one.

Now I did find a simple php5.ini file that I used to increase the file sizes and maximum size fields. And I looked and they should be ample, and uploaded this file to the server in the root directory for the forum. I did not put it in the root of the hosting site. Should I have done that? The guy I talked to at GoDaddy said to put it there. He also said that they refresh their servers usually once a day around midnight. So my php5.ini file should have been run.

But I still have the problem. So not sure how to proceed, but I thought this was the right post to come to and find out?  :)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on April 04, 2012, 06:34:40 PM
Hi, another item in php.ini which have a bearing on this is "post_max_size" which is the total size allowed per post. Have you increased that also? Also try increasing "max_execution_time"

Since it's a 500 error. Is there anything in the your server error logs which could be of help?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: bdtcomp on April 04, 2012, 11:55:19 PM
Hi kays,

Okay I increase max_execution_time from 1600 to 2400 and uploaded it before the clock stroke 12 in Michigan, I figure GoDaddy in Arizona will update in the next few hours.

Quote;max_execution_time = 2400
;max_input_time = 1600
;post_max_size = 128M
;upload_max_filesize = 128M
;memory_limit = 32M

Are the values.

Where is the server error logs?

Thanks.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: bdtcomp on April 05, 2012, 11:11:45 AM
Well I tried a 5.5 jpg and I got the 501 error again. I looked at the smf logs, but nothing. Where is the server log?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on April 06, 2012, 02:36:48 PM
The server error logs would be in your site control panel. If they do exist at all.

Have you tried increasing memory_limit?

Does this only happen with a smart phone?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: bdtcomp on April 06, 2012, 02:43:44 PM
Quote from: Kays on April 06, 2012, 02:36:48 PM
The server error logs would be in your site control panel. If they do exist at all.

Have you tried increasing memory_limit?

Does this only happen with a smart phone?

Smart phone, 1.5 megabytes is fine. I can usually get above 3 megabytes My wife's 8 meg camera takes 5.5 megabytes, and it errors. 

My value is 32M right now. What value would you suggest? I can increase it and check tomorrow!

Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: bdtcomp on April 06, 2012, 03:14:56 PM
I uploaded these values, now with my file.

Quote[PHP]

; - things I changed -
;max_execution_time = 2400
;max_input_time = 1600
;post_max_size = 128M
;upload_max_filesize = 128M
;memory_limit = 96M
;


May try to manually update this evening, but probably have to wait until GoDaddy flushes there server.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: radu81 on April 15, 2012, 01:48:55 PM
hi,
is this mod compatible with SMF 2.0.2? I tryed to install it emulating a version 2.0 RC4 but i get this error:
ERROR!! This version of the mod can only be installed on SMF 2.0 RC4+.

--- edit ---

I installed it without emulating an older version and it works fine. Great mod and very useful, all my users have problems resizing images, with this mod I set no limits for "Max size per attachment" and "Max attachment size per post" and everything is resized at 800px and 85% quality.

I think it should be a core feature of SMF, thanks again for this great mod
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: abraamz on August 10, 2012, 01:55:03 PM
Thank you for a great mod. saved me a lot of space in the server and bandwith in the backups!!
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: polepole on August 28, 2012, 11:58:54 AM
What are the *.jpg_thumb files that are created with zero size?

-Allen
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: bdtcomp on August 28, 2012, 12:08:23 PM
This mod is great for people on our forum uploading their pictures and not having to worry about being a Photoshop geek! It also makes good use of keeping the file size down on the forum. Great mod!
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: beanflying on September 11, 2012, 11:37:38 PM
Having an odd issue installing this mod. Running 2.0.2 and already fairly heavily modded. On install the package shows as Test Successful on all and skips some of the language adds.

On install above the forum it then shows the language strings

// Added for resize attached images mod 2.0. $txt['attachment_image_width'] = 'Maximum width of attached images.
(0 for no maximum width)
'; $txt['attachment_image_height'] = 'Maximum height of attached images.
(0 for no maximum height)
'; $txt['attachment_image_compression'] = 'JPEG quality factor
(Maximum 100, default 75)
'; $txt['attachment_resize_existing'] = 'Resize existing images'; $txt['attachment_image_reformat'] = 'Reformat non-JPEG images to JPEG.'; $txt['attachment_thumb_png'] = 'Save thumbnails as PNG.'; $txt['attachment_gd_warning


and none of the text for the settings in admin are shown as options. Anyone with any thoughts on mod clashes or where this gremlin may be coming from?

BTW The Mod tick boxes are there and the mod is working perfectly :)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: beanflying on September 12, 2012, 01:50:38 AM
Just answered my own question but it seems the install package is adding AFTER the ?> and not before when modifying the Admin.english.php file  ???

Manual edit to fix it and all sorted.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on September 12, 2012, 09:28:28 AM
Yes, what's happened there is that the php closing tag wasn't on the last line of that page.

Glad you got that sorted out. :)

Quote from: polepole on August 28, 2012, 11:58:54 AM
What are the *.jpg_thumb files that are created with zero size?

-Allen

Sorry I missed your post earlier. Are the dates on these files recent?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Mave on September 20, 2012, 02:43:30 PM
I have an 2.0 RC3 and want to install the mod and get error

QuoteERROR!! This version of the mod can only be installed on SMF 2.0 RC4+.

i use the version 2-final

what happend?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on September 20, 2012, 06:02:53 PM
That version of the mod uses several functions which were introduced with the release of RC4. So it will not work for an RC3 forum.

The RC3 version of the mod is still available on the mod page. Use that instead.

Or better yet, update to 2.0.2. ;)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Mave on September 21, 2012, 12:21:04 PM
Quote from: Kays on September 20, 2012, 06:02:53 PM
That version of the mod uses several functions which were introduced with the release of RC4. So it will not work for an RC3 forum.

The RC3 version of the mod is still available on the mod page. Use that instead.

Or better yet, update to 2.0.2. ;)
Yes i know its better to upgrade, but ts need so much time.

Where i can find a version for 2rc3? version 1.5 dont work too.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on September 21, 2012, 08:55:51 PM
Sorry, I thought you could see that mod in the list.

See attached.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: fiver on September 29, 2012, 05:28:34 AM
Quote from: Kays on January 22, 2011, 09:47:17 AM
Are the original images still on the server? Look at the dlattach number for that image. Then check the database for it and the attachment folder. All attachments are now named with the id number as the first digits before the underscore. Followed by the file_hash.


Hi Kays,


Still on the after-uninstall problem more than a year ago... is there any way (script?) to restore all the 2800+ attachments which were renamed by the mod?


Thanks.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Mave on September 29, 2012, 05:48:24 AM
Sorry for late Thanx

With your mod i save 3GB Storage

THANK YOUUUUUUUUU  :-*
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on September 29, 2012, 07:09:22 AM
I think need some more info on this. ???

Are these older files from before SMF 1.1.9? If you search the attachments table for the id, is there a value for "file_hash"?

Can you identify any of these these files on the server? What is the file name format on the server for these files?

What format were these images in originally?

@ Mave, you're welcome. :)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: littlenicki on September 30, 2012, 01:11:02 PM
Hello Kays,

I'm using V1.5 of your mod with SMF 1.1.16. However I'm encountering one problem:

- If a users uploads an image larger than 3500 Pixels (width or height) the script seems to cause a problem. That is it won't resize the files anymore and wnating to access the topic / page containing these images will give a blank page.

Any help would be greatly appreciated.

Thank you,

Nicole
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: novill on September 30, 2012, 02:22:22 PM
hungarian translation

<file name="$themedir/languages/Admin.hungarian.php">
<operation>
<search position="end" />
<add><![CDATA[
// Added for resize attached images mod 2.0.
$txt['attachment_image_width'] = 'Csatolt kép maximális szélessége.<div class="smalltext">(0 ha nincsen maximum szélesség)</div>';
$txt['attachment_image_height'] = 'Csatolt kép maximális magassága.<div class="smalltext">(0 ha nincsen maximum magassága)</div>';
$txt['attachment_image_compression'] = 'JPEG mínőségi faktor<div class="smalltext">(Maximum 100, default 75)</div>';
$txt['attachment_resize_existing'] = 'Meglévő képek átméretezése';
$txt['attachment_image_reformat'] = 'Nem JPEG képek átkonvertálása JPEG formátumra.';
$txt['attachment_thumb_png'] = 'Bélyegképek mentése PNG fájl formátumba.';
$txt['attachment_gd_warning'] = 'A GD modul nincsen jelenleg instalálva. A következő kép átméretezési funkció nem elvégezhető.';
]]></add>
</operation>
</file>

<file name="$themedir/languages/Help.hungarian.php">
<operation>
<search position="end" />
<add><![CDATA[
// Added for resize attached images mod 2.0.
$helptxt['attachment_image_compression'] = 'Ez állítja be a JPEG képmínőségét. A nagyobb szám csökkenti a kép mínőségét, de a kép fájl méretét is. ';
$helptxt['attachment_resize_existing'] = 'Ennek az opciónak az engedélyezése átméretez minden létező csatolt képet, mely nagyobb mint a beállított méretek.';
$helptxt['attachment_image_reformat'] = 'Ennek az opciónak az engedélyezése minden nem JPEG formátumú képet JPEG formátumra konvertál';
]]></add>
</operation>
</file>
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on September 30, 2012, 03:37:10 PM
HI  littlenicki, that sounds like it could be a memory issue.

In Subs_Graphics.php look for the following:


@ini_set('memory_limit', '90M');


And change the 90 to a higher value like 128.

Thanks novill. I'll include that with my next update. :)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: littlenicki on September 30, 2012, 03:57:22 PM
Quote from: Kays on September 30, 2012, 03:37:10 PM
HI  littlenicki, that sounds like it could be a memory issue.

In Subs_Graphics.php look for the following:


@ini_set('memory_limit', '90M');


And change the 90 to a higher value like 128.

Thanks novill. I'll include that with my next update. :)

Hello, thanks for your quick response. Yes, I thought it could be a memory issue, too. I tried raising the value and went up to 300M ... I'm on a decdicated server with 4GB Ram ...

However no changes. Uploading a file larger than 3500 pixels width will give me a blank screen but after the upload and also when wanting to access the posting / topic.

Any suggestions? Thanks!

Regards,

Nicole
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on September 30, 2012, 04:44:43 PM
It still sounds like a timeout problem because it's trying to continually resize that image.

Something to try, in the same place add the following. (default is normally at 30)


@set_time_limit(90);
if (function_exists('apache_reset_timeout'))
@apache_reset_timeout();
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: littlenicki on September 30, 2012, 05:45:40 PM
Thanks a lot it works now!
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on September 30, 2012, 07:44:45 PM
Great. :)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: novill on October 08, 2012, 02:04:26 PM
Great mod. :)

Hungarian translation

<file name="$themedir/languages/Admin.hungarian.php">
<operation>
<search position="end" />
<add><![CDATA[
// Added for resize attached images mod 2.0.
$txt['attachment_image_width'] = 'Csatolt kép maximális szélessége.<div class="smalltext">(0 ha nincsen maximum szélesség)</div>';
$txt['attachment_image_height'] = 'Csatolt kép maximális magassága.<div class="smalltext">(0 ha nincsen maximum magassága)</div>';
$txt['attachment_image_compression'] = 'JPEG mínőségi faktor<div class="smalltext">(Maximum 100, default 75)</div>';
$txt['attachment_resize_existing'] = 'Meglévő képek átméretezése';
$txt['attachment_image_reformat'] = 'Nem JPEG képek átkonvertálása JPEG formátumra.';
$txt['attachment_thumb_png'] = 'Bélyegképek mentése PNG fájl formátumba.';
$txt['attachment_gd_warning'] = 'A GD modul nincsen jelenleg instalálva. A következő kép átméretezési funkció nem elvégezhető.';
]]></add>
</operation>
</file>

<file name="$themedir/languages/Help.hungarian.php">
<operation>
<search position="end" />
<add><![CDATA[
// Added for resize attached images mod 2.0.
$helptxt['attachment_image_compression'] = 'Ez állítja be a JPEG képmínőségét. A nagyobb szám csökkenti a kép mínőségét, de a kép fájl méretét is. ';
$helptxt['attachment_resize_existing'] = 'Ennek az opciónak az engedélyezése átméretez minden létező csatolt képet, mely nagyobb mint a beállított méretek.';
$helptxt['attachment_image_reformat'] = 'Ennek az opciónak az engedélyezése minden nem JPEG formátumú képet JPEG formátumra konvertál';
]]></add>
</operation>
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Glasso on October 08, 2012, 04:25:52 PM
Hi Kays,

When trying to attach a large image, the screen just turns blank after 86 seconds. This does not happen when trying a large non-image file - it just goes back to empty post screen instead.

Have tried increasing memory_limit, @set_time_limit(90), and @apache_reset_timeout() that your suggested, with no effect.

Additionally, I see these errors as in this topic: http://www.simplemachines.org/community/index.php?topic=477508.msg3340564#msg3340564

I am running SMF 2.0.2

Appreciate any help you can offer.
Thanks.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)--BIG PROBLEM
Post by: kennethm on November 28, 2012, 08:49:07 PM
downloaded and installed this mod, NOW cant post any attachment. When you try it acts like it is uploading then screen turns blank then a ZERO appears at top left of screen. Running smf 2.02

Download and install went as normal as can be expected. SO ANY IDEAS what has happened and what can be done to fix it? I even uninstalled the mod and its still doing the same thing, cant post any attachment of any size. Can post normall with no attachments.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: kennethm on November 30, 2012, 01:45:46 AM
any one that knows anything ever reply to thses postings anymore or has it been abandoned
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on December 01, 2012, 10:35:40 AM
Sorry, I'm not online that much lately.

Which version SMF?

Do you have any other attachment related mods installed?

Any errors in the error log?

Can you post an copy of your phpinfo file. What is a phpinfo() file? (http://wiki.simplemachines.org/smf/What_is_a_phpinfo()_file)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: kennethm on December 02, 2012, 01:51:54 AM
smf 2.0.2

no other attachment relate mods installed

no errors in error log

only installed mod is the ad mod

I would really like to use your mod but something went astray. P tell me with my version of smf is there something else i needed to do other than just install it the conventional way? tweak some code, etc?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on December 02, 2012, 03:07:38 PM
No, it should work as long as you imput some values for it.

Just saw your other thread and I'm wondering if some of your problems are server related timeouts. To check that, it would be nice to see your phpinfo file.

http://wiki.simplemachines.org/smf/What_is_a_phpinfo()_file
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: kennethm on December 02, 2012, 10:51:50 PM
<?php phpinfo();Â ?>

folloing the instructions to create that page, once uploaded and looked at in the browser, the above is whats displayed in the page, So whats this mean? If my server doesnt run php then how have i had a working forum for a month until i installed the resize attachment mod?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Howard43Willard on December 03, 2012, 03:07:47 AM
Hi, this mod is for those who wish to cut down on server space. So it does permanently resize all attached images.
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.rlgf.info%2F16.jpg&hash=dc1425e302a1f67c50bf3fc6418b51d6ae0c0fea)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.rlgf.info%2F17.jpg&hash=6bd8e002f3b435f402ebd5e93b968f23f0096687)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.sbqg.info%2F19.jpg&hash=89f25dba014d830dd4240c0b33d6c05e813258df)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on December 03, 2012, 11:23:29 AM
Quote from: kennethm on December 02, 2012, 10:51:50 PM
<?php phpinfo();Â ?>

folloing the instructions to create that page, once uploaded and looked at in the browser, the above is whats displayed in the page, So whats this mean? If my server doesnt run php then how have i had a working forum for a month until i installed the resize attachment mod?

Your server does support php since SMF requires that it be installed.

The contents should be <?php phpinfo(); ?>. Don't know where the "Â" came from or if it's messing things up.. Also the file extension needs to be .php.

Quote from: Howard43Willard on December 03, 2012, 03:07:47 AM
Hi, this mod is for those who wish to cut down on server space. So it does permanently resize all attached images.


Yes the resize is permanent.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: kennethm on December 03, 2012, 12:39:15 PM
what folder/place do you need that file uploaded to or does it matter
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on December 03, 2012, 07:23:25 PM
It doesn't matter. Either the root of your site or in the same folder your forum is in.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: kennethm on December 04, 2012, 12:04:45 AM
i make and save a php file, i copy and paste ONLY the text you said to include in the file, i upload to the server. I still get what i posted earlier?? Am i missing something or what is the problem?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on December 06, 2012, 11:01:37 AM
Sorry, but I don't know what the problem there is.

All that I can suggest is that you go to the mod page, parse the mod and verify that all of the edits the mod makes were removed. Except for one file it's all well identified.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Rob Lightbody on April 10, 2013, 06:03:58 AM
Hello,

This Mod seems like just the thing to allow my SMF forum to compete with its Facebook rivals.  I can't understand why there aren't hundreds of excited posts in here about it?

My users, who are often fairly old and technically unskilled, MUST be able to upload any old photo or scan that they have, and let the server worry about resizing it for them.  Everything else I've tried has just confused them.

Is this Mod OK with 2.0.4. ?

Thanks,

- Rob
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Rob Lightbody on April 10, 2013, 02:42:05 PM
Quote from: kizer on February 25, 2011, 05:20:15 PM
I installed it in 2.0 RC 5 and this is what I get when I look at any of my Mod settings in the admin panel. It shows up in the header and it looks like some of my Div tags are wacked out because some of my settings appear to be shifted or simply look to have been erased. LOL


// Added for resize attached images mod 2.0. $helptxt['attachment_image_compression'] = 'This sets the JPEF quality factor. A higher number increases image quality but also increase the file size. '; $helptxt['attachment_resize_existing'] = 'Selecting this option will resize any existing images which are larger than the set dimensions for attached images.'; $helptxt['attachment_image_reformat'] = 'Selecting this option will reformat any non-JPEG images into the JPEG format';


I get this too - on 2.0.4.  It gave me a fright, so I uninstalled the mod until I could find out more.

Thanks to Kizer's earlier comments, I then discovered that it had put the text in admin.english.php in after the ?>  I corrected this, and it resolved the problem.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Rob Lightbody on April 10, 2013, 03:01:45 PM
Wow!

It works!  By eck it works!!

This functionality MUST be included in a future release of SMF, absolutely dynamite!

I just uploaded an 8mb digital camera photo (from a modern 14mp camera) and it was seamlessly shrunk down to a normal size.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on April 10, 2013, 04:29:18 PM
Great, glad you got that sorted out. :)

Something like that occurs when the ?> is not on the last line. It can happen with with any mod.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: lc62003 on October 25, 2013, 10:41:38 AM
This is a great mod!  But I am having an issue.  :-X

When old images get resized they no longer show.  If the link is clicked a 404 is produced.  The mod was installed on 2.0.5 now upgraded to 2.0.6.  The images appear to still be on the server.  I can download, add the .jpg and view them just fine.  They are indeed resized.  I can find the entry in the database as well.  I'm not sure what doesn't jive here.   :-[

Worth noting:  the forum does have two attachment folders as the original is quite large.  Not sure if that' related at all. 

How can I fix this?   :)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: lc62003 on November 17, 2013, 03:08:06 PM
Hola?   :D
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on November 19, 2013, 06:39:10 PM
Hi, sorry about the delay. Not been online much lately.

I tried to replicate the problem but it seems to work for me. ???

In which folder are the problem files?

The files on the server how are they named? For any files added after 1.1.9 or 2.0 final the name should be the file id, an undescore (_) followed by the file hash. Check the database and see if this is correct for one of the problem files. Also in the database the folder id will be 1 for the original attachments folder and increments from there for each added folder. Check if that's correct.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: lc62003 on November 20, 2013, 09:17:26 AM
Quote from: Kays on November 19, 2013, 06:39:10 PM
Not been online much lately.

Hope things are well for you.   ;)



Quote from: Kays on November 19, 2013, 06:39:10 PM

In which folder are the problem files?


The original folder is called attachments.  The new one is attachments2.  I can't say for certain this is exclusive as this affects many files but the problem attachments I've found reside in attachments. 


Quote from: Kays on November 19, 2013, 06:39:10 PM

The files on the server how are they named? For any files added after 1.1.9 or 2.0 final the name should be the file id, an undescore (_) followed by the file hash. Check the database and see if this is correct for one of the problem files.

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    



I'm not seeing a filehash database entry.  If I copy an paste the remainder of the filename after 'JPG' into the database it still does not work.  This is the hash or no? 
Also noting the database 'size' and filesize denoted by the server are different as well. 

(The hash I posted is incomplete......could that be a security risk to post it complete?)


Thanks!! 
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on November 20, 2013, 08:11:26 PM
It looks like that file is named using the old encryption method which doesn't use "file_hash" but rather a md5 hash of the file name.

Try changing the JPG to lowercase. "117963_DSCF0958_jpg3497f7e437ffce635e7095e"

Also it looks like the folder id is 3. Which folder is this file from?

I've got to look at the mod to see how it handles the old style of encryption.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: lc62003 on November 20, 2013, 09:21:39 PM
Well it's a start!   :)  The filename change didn't fix it. 

Yeah, I'm not sure about the folder number.  Noticed that before too.  I'm not the original owner of this forum so who knows what folder swapping has occured.  Naturally it's been migrated several times as well.  I should have mentioned the age of this forum as well. 

The database contains folders 1, 2, and 3.  2 is apparently the avatar folder. 

Ideas for a next move?   :D
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: ModelBoatMayhem on November 27, 2013, 06:48:11 AM
 
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?

Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Hristo on November 27, 2013, 09:42:48 AM
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
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: ModelBoatMayhem on November 27, 2013, 10:12:44 AM
 
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 !

Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Hristo on November 27, 2013, 01:23:11 PM
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
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: ModelBoatMayhem on November 27, 2013, 04:04:17 PM
Re: 1

http://www.simplemachines.org/community/index.php?topic=342947.msg2314619#msg2314619 (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 (https://github.com/Spuds?tab=repositories)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Hristo on November 27, 2013, 07:00:56 PM
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.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: lc62003 on December 05, 2013, 01:06:15 PM
Any news?   ;)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on December 07, 2013, 09:33:34 AM
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?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: lc62003 on December 08, 2013, 03:23:52 PM
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";}
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on December 09, 2013, 01:11:17 PM
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?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: lc62003 on December 09, 2013, 03:59:34 PM
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. 
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: lc62003 on December 23, 2013, 03:03:35 PM
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.   ;)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kays on December 24, 2013, 05:38:31 PM
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?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: lc62003 on December 25, 2013, 09:38:51 PM
Changing to upper case in the DB is a no-go.  No thumbnails either.   :(
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: lc62003 on January 13, 2014, 02:46:52 PM
A few days shy of 3 mos.  Thanks for your time.  I'm done with this one.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Beer on January 28, 2014, 06:57:12 AM
 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р://site.beer/forum/index.php?action=admin;area=featuresettings;sa=layout;)
if load 1000px - not resized;
if load 1200px - working Image Resize to 900 (httр://site.beer/forum/index.php?action=admin;area=manageattachments;sa=attachments).

Thank you! ;)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: KungFuJoe on February 08, 2014, 07:23:34 PM
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.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: melanieh75 on April 23, 2014, 12:10:37 PM
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.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: melanieh75 on May 05, 2014, 10:05:01 AM
I wonder if this thread is being monitored anymore?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Westwegoman on May 06, 2014, 04:02:24 AM
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?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: 72 454 on May 28, 2014, 01:38:37 PM
I just started using this mod on a new forum and it works great. However, when in the admin panel there's some code embedded at the top of the page. The first line is:  // Added for resize attached images mod 2.0. $txt['attachment_image_width'] = 'Maximum width of attached images.


This is followed by some code below it.

(0 for no maximum width)
'; $txt['attachment_image_height'] = 'Maximum height of attached images.
(0 for no maximum height)
'; $txt['attachment_image_compression'] = 'JPEG quality factor
(Maximum 100, default 75)
'; $txt['attachment_resize_existing'] = 'Resize existing images'; $txt['attachment_image_reformat'] = 'Reformat non-JPEG images to JPEG.'; $txt['attachment_thumb_png'] = 'Save thumbnails as PNG.'; $txt['attachment_gd_warning'] = 'The GD module is currently not installed. The following image resize functions can not be performed.';




It doesn't seem to affect anything other than within the admin panel and users don't see it, but please let me know how to fix it. Using 2.0.7. It's also appearing in the default Curve theme. Here's a pic in the admin options panel


Tnx.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: melanieh75 on June 08, 2014, 11:08:20 AM
I don't think this one is being monitored anymore. I posted for help in April and nothing back yet.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: luuuciano on June 17, 2014, 06:02:06 PM
Question... this mod resizes images every time it is seen? or just once at upload time? (that last is what I am looking for...)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Westwegoman on June 17, 2014, 06:42:05 PM
It resizes on upload and will resize current images the first time they are viewed.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: luuuciano on June 17, 2014, 10:35:40 PM
Quote from: Westwegoman on June 17, 2014, 06:42:05 PM
It resizes on upload and will resize current images the first time they are viewed.

Thanks Westwegoman! will try it then :)

Done, installed and a few little testing...

Amazing mod! I LOVE IT!

This and the spud's ILA
https://github.com/Spuds/SMF-ILA

ROCKSSSSSS
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: luuuciano on June 17, 2014, 10:38:10 PM
Quote from: 72 454 on May 28, 2014, 01:38:37 PM
This is followed by some code below it.

(0 for no maximum width)
'; $txt['attachment_image_height'] = 'Maximum height of attached images.
(0 for no maximum height)
'; $txt['attachment_image_compression'] = 'JPEG quality factor
(Maximum 100, default 75)
'; $txt['attachment_resize_existing'] = 'Resize existing images'; $txt['attachment_image_reformat'] = 'Reformat non-JPEG images to JPEG.'; $txt['attachment_thumb_png'] = 'Save thumbnails as PNG.'; $txt['attachment_gd_warning'] = 'The GD module is currently not installed. The following image resize functions can not be performed.';

Something is wrong on your language file/s, you still have that problem??
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Westwegoman on June 18, 2014, 06:59:16 AM
Quote from: luuuciano on June 17, 2014, 10:38:10 PM
Quote from: 72 454 on May 28, 2014, 01:38:37 PM
This is followed by some code below it.

(0 for no maximum width)
'; $txt['attachment_image_height'] = 'Maximum height of attached images.
(0 for no maximum height)
'; $txt['attachment_image_compression'] = 'JPEG quality factor
(Maximum 100, default 75)
'; $txt['attachment_resize_existing'] = 'Resize existing images'; $txt['attachment_image_reformat'] = 'Reformat non-JPEG images to JPEG.'; $txt['attachment_thumb_png'] = 'Save thumbnails as PNG.'; $txt['attachment_gd_warning'] = 'The GD module is currently not installed. The following image resize functions can not be performed.';

Something is wrong on your language file/s, you still have that problem??

Just a hunch here but, open up Themes\default\languages\Admin.english.php and make sure the following is at the end of the file.
?>

If it is not, then you will have to move it to the very last line.

If using utf8, you also have to do it in Admin.english-utf8.php
Title: problem
Post by: _sebas_ on September 16, 2014, 11:02:07 PM

hi

little by little, and from time to time, I've been having the occasional mistake, she increasingly corrupt images in forum

thumbnails always look good, but to expand a magnified image appears entirely black,


when this happens, I notice that in the log. error

-----

error mess.:

8: getimagesize() [<a href='function.getimagesize'>function.getimagesize</a>]: Read error!
Archivo: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/Sources/Display.php
Línea: 1325
-------------------------
2: imagecreatefromjpeg() [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file
Archivo: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/Sources/Subs-Graphics.php
Línea: 1706
-------------------------
2: imagecreatefromjpeg() [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: '/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/attachments/2464_ba6dd1aa16f5f9bde9b84605ebd4a58ebeb04d0f' is not a valid JPEG file
Archivo: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/Sources/Subs-Graphics.php
Línea: 1706
-------------------------
2: imagecopyresampled(): supplied argument is not a valid Image resource
Archivo: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/Sources/Subs-Graphics.php
Línea: 1724
-------------------------
2: imagedestroy(): supplied argument is not a valid Image resource
Archivo:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/Sources/Subs-Graphics.php
Línea: 1733



(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.astronomo.org%2Fforo%2Findex.php%3Faction%3Ddlattach%3Btopic%3D4577.0%3Battach%3D2459%3Bimage&hash=47a129fced430743d157e33f7355b904dc1b77f9)

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.astronomo.org%2Fforo%2Findex.php%3Faction%3Ddlattach%3Btopic%3D4577.0%3Battach%3D2458%3Bimage&hash=06928b66117117bed14247f668b263a3c1d1c4a4)

please, what is wrong ?
Who is causing this?
any ideas or help?
how I can recuperarl original image?
(apparently the file is full of information, but it comes in black)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: kokett on February 11, 2015, 04:14:31 AM
Hello,

is there a simple way to modify your "clean_thumbs.php" script to delete all attachments on server if they are NOT in databse?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Trond Dahl on March 09, 2015, 09:42:33 AM
I am running smf 1.1.20.
Should I attempt to install version 1.5 or 2? Is 2 aimed for smf 2.x forums?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Steve on March 10, 2015, 10:16:40 AM
Check the first post. That shows which version was updated for 2.0 ... ;)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Rogerd on April 05, 2015, 05:36:55 AM
Hi All, After installing this mod, I tried uploading a 4MB attachment and got this error "Fatal error: Allowed memory size of 50331648 bytes exhausted (tried to allocate 16000 bytes) in /home/*******/public_html/Sources/Subs-Graphics.php on line 1706" using SMF 1.1.20 thanks for any replies.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Dragon41673 on May 23, 2015, 08:07:50 AM
To Anyone currently using this mod...

#1 - Does anyone use it on 2.0.9 or 2.0.10 If so...any issues?

#2 - Just for clarification...this mod will automatically resize the attached image in the background of SMF during the upload...right?

I ask because my new host has size limitations for disk space, whereas my previous host did not. People are now upset that they now have to resize their posting attachments so I was looking for a program that will do it automatically for them during the upload for their post.

Thanks
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: luuuciano on May 23, 2015, 09:42:22 AM
yes, no
yes
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Dragon41673 on May 23, 2015, 09:43:58 AM
LOL awesome...thank you! I'll try it later today on 2.0.10 & let you know if it seems to work.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: luuuciano on May 23, 2015, 10:31:05 AM
BTW we are using the attached image/files inline (do not remember the name right name) mod too, it is a nice add on to this one...
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Dragon41673 on May 23, 2015, 10:36:55 AM
Quote from: luuuciano on May 23, 2015, 10:31:05 AM
BTW we are using the attached image/files inline (do not remember the name right name) mod too, it is a nice add on to this one...

Just did a quick search and did not come up with anything similar to what you stated. If you figure out which one it is, I'll take a peek at it.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: luuuciano on May 23, 2015, 04:32:50 PM
This one https://github.com/Spuds/SMF-ILA
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Dragon41673 on May 23, 2015, 08:22:31 PM
I can confirm it works perfectly on 2.0.10

As far as the other package, I'd rather only download ones directly from this site...but thank you!
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: luuuciano on May 24, 2015, 01:32:18 PM
Well, that mod was here in the past, but Spuds choose to continue using git only as repository resource (as several other modders here and there)...
It was his call, and yes... it is your call to use it or not lol
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Dragon41673 on May 24, 2015, 01:43:58 PM
Trust me, I'd love to use some mods outside of these forums...but there's always that chance something could be wrong with them. At least if they are here...there's support "here" for it. Thank you again!
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Fat Rat on October 09, 2015, 04:53:25 AM
Hello, I have installed v2 final of this mod onto SMF 2.0.11 and am now receiving this error. I have uninstalled and reinstalled and that seems to have made matters worse?

// Added for resize attached images mod 2.0. $txt['attachment_image_width'] = 'Maximum width of attached images.
(0 for no maximum width)
'; $txt['attachment_image_height'] = 'Maximum height of attached images.
(0 for no maximum height)
'; $txt['attachment_image_compression'] = 'JPEG quality factor
(Maximum 100, default 75)
'; $txt['attachment_resize_existing'] = 'Resize existing images'; $txt['attachment_image_reformat'] = 'Reformat non-JPEG images to JPEG.'; $txt['attachment_thumb_png'] = 'Save thumbnails as PNG.'; $txt['attachment_gd_warning'] = 'The GD module is currently not installed. The following image resize functions can not be performed.';?> // Added for resize attached images mod 2.0. $txt['attachment_image_width'] = 'Maximum width of attached images.
(0 for no maximum width)
'; $txt['attachment_image_height'] = 'Maximum height of attached images.
(0 for no maximum height)
'; $txt['attachment_image_compression'] = 'JPEG quality factor
(Maximum 100, default 75)
'; $txt['attachment_resize_existing'] = 'Resize existing images'; $txt['attachment_image_reformat'] = 'Reformat non-JPEG images to JPEG.'; $txt['attachment_thumb_png'] = 'Save thumbnails as PNG.'; $txt['attachment_gd_warning'] = 'The GD module is currently not installed. The following image resize functions can not be performed.';
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Fat Rat on October 19, 2015, 03:34:25 PM
Can anyone assist?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Mimmi on October 26, 2015, 07:40:34 AM
Thank you for this mod!

I've translated it to Norwegian:
// Added for resize attached images mod 2.0.
$helptxt['attachment_image_compression'] = 'Dette definerer JPEG-kvaliteten. Et høyere nummer øker bildekvaliteten, men øker også filstørrelsen.';
$helptxt['attachment_resize_existing'] = 'Å velge dette alternativet vil endre størrelsen på alle eksisterende bilder som er større enn de definerte størrelsen for bildevedlegg.';
$helptxt['attachment_image_reformat'] = 'Å velge dette alternativet vil reformatere alle eksisterende bilder som ikke er JPEG til JPEG.';


// Added for resize attached images mod 2.0.
$txt['attachment_image_width'] = 'Maks bredde på vedlagte bilder.<div class="smalltext">(0 for ingen maksgrense)</div>';
$txt['attachment_image_height'] = 'Maks høyde på vedlagte bilder.<div class="smalltext">(0 for ingen maksgrense)</div>';
$txt['attachment_image_compression'] = 'JPEG-kvalitet<div class="smalltext">(Maks 100, standard 75)</div>';
$txt['attachment_resize_existing'] = 'Endre eksisterende bilder';
$txt['attachment_image_reformat'] = 'Reformater ikke-JPEG bilder til JPEG.';
$txt['attachment_thumb_png'] = 'Lage tommelbilder (miniatyrer) som PNG.';
$txt['attachment_gd_warning'] = 'GD-modulen er ikke installert. Den følgende funksjonen for å endre størrelsen kan ikke kjøres.';
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: cortez on February 21, 2016, 08:56:18 AM
How to make this mod compatible for other themes? It doesn't have the code for that so when instelled whenever I log in admin backend I have strings for this mod on top of page.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Goshdarnit on December 31, 2016, 08:09:25 AM
Quote from: Westwegoman on June 18, 2014, 06:59:16 AM

Just a hunch here but, open up Themes\default\languages\Admin.english.php and make sure the following is at the end of the file.
?>

If it is not, then you will have to move it to the very last line.

If using utf8, you also have to do it in Admin.english-utf8.php


To everyone having problems with the string of messages at the top of their forum (Fat Rat and cortez), Westwegoman's solution on the previous page (quoted above in this message) fixed it for me. Just open that Admin.english.php file and scroll to the end. You need to place the last question mark on a new line, rather than at the end of a line with other code in it. Then install the mod. Worked perfectly for me after this.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: landyvlad on January 23, 2017, 11:29:14 PM
Is there a way - with either this mod or SMF core functionality - to have attachments placed in posts as full size images, rather than thumbnails which people need to click on?

An existing forum I'm on (running on ANCIENT outdated 'community forum' software) does this easily.  Surely this can be accomplished with SMF?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: luuuciano on January 24, 2017, 08:17:42 AM
Quote from: landyvlad on January 23, 2017, 11:29:14 PM
Is there a way - with either this mod or SMF core functionality - to have attachments placed in posts as full size images, rather than thumbnails which people need to click on?

An existing forum I'm on (running on ANCIENT outdated 'community forum' software) does this easily.  Surely this can be accomplished with SMF?

In our forum we are using ILA inline attachments, by spuds
https://github.com/Spuds/SMF-ILA
It works nice, you can select how to show images... 3rd option is like that
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: GL700Wing on January 25, 2017, 02:19:21 AM
Quote from: landyvlad on January 23, 2017, 11:29:14 PM
Is there a way - with either this mod or SMF core functionality - to have attachments placed in posts as full size images, rather than thumbnails which people need to click on?

An existing forum I'm on (running on ANCIENT outdated 'community forum' software) does this easily.  Surely this can be accomplished with SMF?
The main problem with having images display as full size is that, for images with resolutions larger than the screen they are being displayed on, you can end up having to scroll to see the image.

I use a modified version of the ILA inline attachments mod (I have the image size and resolution displayed below the image name in horizontal mode - see attached pic) in conjunction with a fixed version of FancyBox 4 SMF (there was a bug in the JS that prevented the slideshow from working) and it works well on both desktop and mobile devices.

Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: landyvlad on January 26, 2017, 09:40:22 PM
You have a link where I can see that in action?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: GL700Wing on January 29, 2017, 09:48:57 PM
Quote from: landyvlad on January 26, 2017, 09:40:22 PM
You have a link where I can see that in action?
Here ya go: Finished My Bike (http://www.australiancx.asn.au/forum/index.php?topic=14384.0) and Posting Pics (http://www.australiancx.asn.au/forum/index.php?topic=14174.msg148008#msg148008)   ;)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: landyvlad on January 30, 2017, 07:58:46 PM
Oh it's YOU Kathy !  I'm the same Vlad as on the CX forum !
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: GL700Wing on January 30, 2017, 08:00:59 PM
Quote from: landyvlad on January 30, 2017, 07:58:46 PM
Oh it's YOU Kathy !  I'm the same Vlad as on the CX forum !
Yep - it's me and I knew it was you - I was just playing with you!!  :)

(Actually - thought you might have worked out who I was from the strip of pics I posted in my earlier reply)
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: landyvlad on January 30, 2017, 08:09:12 PM
Seems I'll have to go and find this fancybox thingy and see if it does what I need eh.

.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: GL700Wing on January 30, 2017, 08:35:14 PM
Quote from: landyvlad on January 30, 2017, 08:09:12 PM
Seems I'll have to go and find this fancybox thingy and see if it does what I need eh.
It won't do the slideshow thing without the fix I've done (it currently stops after the first slide) but if you'd like I can send you the files you need for that.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: landyvlad on January 30, 2017, 09:12:05 PM
Cheers mate.  I'd appreciate it. I think you have my email :)

My main issues is that

One one hand I have members who want attachments to be 'fit to screen' size on their PC's.
On the other hand mobile users who whinge if the image needs scrolling when viewed on mobile.

I just need a way to keep everyone happy.... LOL
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Harvester on June 11, 2017, 08:55:14 PM
I just installed this on 2.0.14 and it installed with no errors and works perfectly. Thank you for this VERY useful Mod!

Now a days with people uploading images from their phone, being able to have the site resize them is so very needed. This Mod did exactly that.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: TomW on June 20, 2017, 11:29:29 AM
Quote from: Harvester on June 11, 2017, 08:55:14 PM
I just installed this on 2.0.14 and it installed with no errors and works perfectly. Thank you for this VERY useful Mod!

Now a days with people uploading images from their phone, being able to have the site resize them is so very needed. This Mod did exactly that.

That's good to know.  If this mod still supported ?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Ed2 on October 10, 2017, 09:43:25 PM
Within Godaddy we upgraded from Linux Deluxe to C-Panel hosting and just noticed that "Resize Attached Images" won't function with large image attachments.   If the images are reduced it works fine. Also noticed that the forum indicates that  "Resize Attached Images 2.4.1" version is loaded?  Don't see a 2.4.1 version in the down load section? 


Forum is running SMF 2.0.14

   
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Steve on October 27, 2017, 09:30:56 AM
The author of this mod hasn't been here since December 14, 2014 so you're unlikely to get much help unfortunately.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Tonyvic on October 27, 2017, 11:11:34 AM
On the Mod page it does state
QuoteLatest Version: 1.5 / 2.4.1
I assume that
QuoteResizeAttachedImages_2-final.zip
will be that version.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Rob Lightbody on March 16, 2018, 03:07:44 PM
Quote from: Ed2 on October 10, 2017, 09:43:25 PM
Within Godaddy we upgraded from Linux Deluxe to C-Panel hosting and just noticed that "Resize Attached Images" won't function with large image attachments.   If the images are reduced it works fine. Also noticed that the forum indicates that  "Resize Attached Images 2.4.1" version is loaded?  Don't see a 2.4.1 version in the down load section? 

Forum is running SMF 2.0.14

I'm having no problems with it on SMF 2.0.15. - in fact its completely invaluable to me.  PHP settings may need fiddled with to get your host to allow large image files, fortunately mine does.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: landyvlad on April 03, 2018, 01:29:41 AM
I just installed this on 2.0.15

The install process showed no errors, and the settings page is there HOWEVER please see the top of the attached image and you'll see the problem.

It doesn't seem to appear anywhere except when I'm in the admin area.  I don't think logged in users can see it.  Anyone know what causes this problem and, more importantly, how to fix it?

Ta muchly.

Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: GL700Wing on April 03, 2018, 02:04:04 AM
Quote from: landyvlad on April 03, 2018, 01:29:41 AM
I just installed this on 2.0.15

The install process showed no errors, and the settings page is there HOWEVER please see the top of the attached image and you'll see the problem.

It doesn't seem to appear anywhere except when I'm in the admin area.  I don't think logged in users can see it.  Anyone know what causes this problem and, more importantly, how to fix it?

https://www.simplemachines.org/community/index.php?topic=342947.msg3709500#msg3709500
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: EthanR on September 05, 2018, 07:38:31 PM
Adding this extra code to this mod makes it much better equipped to handle uploads from phones to get the orientation correct:

https://www.simplemachines.org/community/index.php?topic=521231.msg3865613#msg3865613

Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: CarstenP on March 19, 2019, 07:39:47 AM
Maybe a long shot as there has not been any post a longtime.

I'm using SMF 2.0.15 and have installed the mod without any errors or warnings.

When testing it with a 6MB picture it does not give you any errors, but instead of adding the post to the tropic, it opens a blank "start new tropic" page, what the heck do I do wrong ??

I can also see that it do not change the size of the file.

BR
Carsten
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: GL700Wing on March 19, 2019, 10:29:57 PM
This mod hasn't been updated in almost six years (and the author hasn't logged in since late 2014) - the Automatic Attachment Rotation (and Resize) (https://custom.simplemachines.org/mods/index.php?mod=4087) mod does the same thing (and more).

Also, you may want to consider installing the Improved Attachment Error Handling (https://custom.simplemachines.org/mods/index.php?mod=3255) and  Image Processing Memory Limit (https://custom.simplemachines.org/mods/index.php?mod=4111) mods to help with processing large images (issues/errors occurring with uploading/processing images have more to do with the pixel size of the image [eg, 4000x6000] than the actual file size [eg, 6Mb]).  If you want to use these two mods they should be installed before the Automatic Attachment Rotation (and Resize) (https://custom.simplemachines.org/mods/index.php?mod=4087) mod.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: CarstenP on March 20, 2019, 12:13:31 PM
Hi as i said it maybe a longshot.

Thanks for the respons and I tried your suggestions, get the same error as before, and I get a error when adding Improved Attachment Error Handling, see attached pic. erstat = replace and tilføj før = add before
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Sir Osis of Liver on March 20, 2019, 12:17:24 PM
I've been using this mod for a while on 2.0.15 forum, works fine.  Do you have the current ResizeAttachedImages_2-final.zip?  You may have a conflict with another mod.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: CarstenP on March 20, 2019, 01:29:44 PM
Yes I have downloaded the latest version from the link on the first link

Only MOD I have installed is "Yet Another YouTube BBCode Tag" uninstalled it and still have the same issue  :'(
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Sir Osis of Liver on March 20, 2019, 10:27:59 PM
Have you tried doing the edit manually?
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: CarstenP on March 22, 2019, 01:33:46 PM
Quote from: Sir Osis of Liver on March 20, 2019, 10:27:59 PM
Have you tried doing the edit manually?

Not yet, hope to find time to do it during the weekend.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Sir Osis of Liver on September 15, 2021, 12:04:42 PM
Anyone supporting this mod?  One of my guys is getting complaints that some images are loading upside down.  Works fine for me on his forum and one of mine.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Arantor on September 15, 2021, 01:24:24 PM
Quote from: Sir Osis of Liver on September 15, 2021, 12:04:42 PMAnyone supporting this mod?  One of my guys is getting complaints that some images are loading upside down.  Works fine for me on his forum and one of mine.


Are the pictures from a phone? Are you viewing on them on a phone?

Phone pictures are inevitably taken rotated and have a flag in them to say which way around they're meant to be shown - but desktop browsers have a habit of not respecting that flag and just showing them how they were stored, which is often not correct compared to how the photo declares itself.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Sir Osis of Liver on September 15, 2021, 09:32:49 PM
AFAIK there's nothing in this mod that would rotate an image.  This seems to be something that just started recently.  Been trying to get more info from forum owner, nothing yet.  Attachments upload and display normally on pc, but I do see the upside down images on previous posts.  There's a newer mod (Automatic Attachment Rotation (and Resize)) that rotates phone images, it's in his package manager uninstalled.  Don't remember if we installed it, don't see a package backup for it.  If we can't determine the cause will try that.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Arantor on September 16, 2021, 08:15:23 AM
Ah but there is. Remember how I said that the images were stored in the wrong orientation and fixed by (some) browsers ar display time?

That only works if you don't strip the EXIF data. Guess what resize via GD will do... strip the data that tells the browser "hey this image is really the wrong way around, rotate it when you display it"...
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Sir Osis of Liver on September 16, 2021, 05:33:03 PM
But the upside down images are upside down if you d/l the file and view it in image editor.  They've been fixing it by d/ling the file, rotating it in editor, u/ling it.  Will wait to hear back from them, if problem continues we'll try the other mod.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Kindred on September 16, 2021, 05:43:17 PM
Quote from: Sir Osis of Liver on September 16, 2021, 05:33:03 PMBut the upside down images are upside down if you d/l the file and view it in image editor.  They've been fixing it by d/ling the file, rotating it in editor, u/ling it.  Will wait to hear back from them, if problem continues we'll try the other mod.


That's the point.   The resizer removes the exif data that tells the system to rotate it.  If you download the file from the forum, you are downloading the altered file. By rotating and re-saving it, you are literally altering the file on a computer - so, of course that results in the re-uploaded file being correct.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Sir Osis of Liver on September 16, 2021, 05:56:35 PM
The attachments that haven't been fixed are upside down, thumbs and pics are displayed upside down, jpg is upside down when viewed in editor.  If the original images were rightside up, then they were rotated when attached.  The old mod resize we're running doesn't rotate images, been using it on one of my forums for couple of years.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Arantor on September 17, 2021, 04:05:05 AM
You're still missing the point.

Some photos will be upside down in some editors *anyway*. Because they're physically stored that way and not every editor bothers to check the EXIF data to see if it needs to rotate on loading (not saving).

But this mod is going to break that if that's how the image was taken because it removes the "I'm actually upside down" marker.
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Opel-GT-Cabrio on April 25, 2023, 01:20:05 PM
Hello everybody,

very quiet here which seems to be sign for the smoothly running mod (does a great job in my forum since 10 years).
Unfortunately only up to the moment when I had to switch vom PHP 7.4 to PHP 8.
Now the mod throws a critical error "Path cannot be empty" when trying to post something with an attachment.

Anybody out there who experienced the same and has a solution for that?

@Kays: Are you still around and able to help?

Running my forum with SMF 2.0.19 under PHP 8.

Kind regards from Germany,
Norbert
Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: Cuda Cody on November 21, 2023, 03:08:42 PM
@GL700Wing  I have tried the Automatic Attachment Rotation mod and I might be not using it right?  I was using the Resize Attached Images mod before our upgrade and what was nice since it resized the images before (or during) the upload process and made it easy for users to share photos.  The  Automatic Attachment Rotation mod seems really powerful however I can not seem to find where I set it to resize the image before or during upload so the user does not have to re-size before posting. The work around Image Processing Memory Limit mods does not seem to work with version 2.1.4.

Is there a way to update the original Resize Attached Images.  I've attached a screen shot of the settings we were using and it made it some anyone could upload any size photo and it didn't waste our disk space since it always resized them as it uploaded. 

Is there a way to make Automatic Attachment Rotation mod allow for unlimited photo size upload and resize it without eating up all our disk space?

Quote from: GL700Wing on March 19, 2019, 10:29:57 PMThis mod hasn't been updated in almost six years (and the author hasn't logged in since late 2014) - the Automatic Attachment Rotation (and Resize) (https://custom.simplemachines.org/mods/index.php?mod=4087) mod does the same thing (and more).

Title: Re: Resize Attached Images (Updated for 2.0 RC4)
Post by: GL700Wing on November 21, 2023, 03:57:55 PM
Quote from: Cuda Cody on November 21, 2023, 03:08:42 PM@GL700Wing  I have tried the Automatic Attachment Rotation mod and I might be not using it right?  I was using the Resize Attached Images mod before our upgrade and what was nice since it resized the images before (or during) the upload process and made it easy for users to share photos.  The  Automatic Attachment Rotation mod seems really powerful however I can not seem to find where I set it to resize the image before or during upload so the user does not have to re-size before posting. The work around Image Processing Memory Limit mods does not seem to work with version 2.1.4.

Is there a way to update the original Resize Attached Images.  I've attached a screen shot of the settings we were using and it made it some anyone could upload any size photo and it didn't waste our disk space since it always resized them as it uploaded. 

Is there a way to make Automatic Attachment Rotation mod allow for unlimited photo size upload and resize it without eating up all our disk space?

Quote from: GL700Wing on March 19, 2019, 10:29:57 PMThis mod hasn't been updated in almost six years (and the author hasn't logged in since late 2014) - the Automatic Attachment Rotation (and Resize) (https://custom.simplemachines.org/mods/index.php?mod=4087) mod does the same thing (and more).

If you are having issues with the  Automatic Attachment Rotation (and Resize) (https://custom.simplemachines.org/mods/index.php?mod=4087) mod please post the details in a message in the support topic for that mod.

Please note that the functionality of the Resize Attached Images (Updated for 2.0 RC4) (http://custom.simplemachines.org/mods/index.php?mod=2206) mod - which has not been updated since early 2013 - was incorporated into the Automatic Attachment Rotation (and Resize) (https://custom.simplemachines.org/mods/index.php?mod=4087) mod in early 2018 and the functionality of the Image Processing Memory Limit (https://custom.simplemachines.org/mods/index.php?mod=4111) mod (which is not compatible with SMF 2.1) was incorporated into the Automatic Attachment Rotation (and Resize) (https://custom.simplemachines.org/mods/index.php?mod=4087) mod in late 2020.

Also, the  Resize Attached Images (Updated for 2.0 RC4) (http://custom.simplemachines.org/mods/index.php?mod=2206)  mod only ever resized/compressed image attachments during the posting phase (ie, after the images have been attached/uploaded and while the message is being saved) using the image compression, width and/or height values configured for the mod. 

With the attachments system in SMF 2.1 a file size is now shown when a file is attached/uploaded (this did/does not happen in SMF 2.0) and for an image this is the size of the file before it is resized/compressed by the Automatic Attachment Rotation (and Resize) (https://custom.simplemachines.org/mods/index.php?mod=4087) mod.  With SMF 2.1, and even though an image attachment is resized/compressed just after it is attached/uploaded and before a message is saved,  I have not been able to work out how to get the JS code to display the actual file size of a resized/compressed image (or to use the actual file size value of all the resized/compressed images when calculating the total size of all attachments).

If you use the same values in the Automatic Attachment Rotation (and Resize) (https://custom.simplemachines.org/mods/index.php?mod=4087) mod that you were using in this mod the images will be resized/compressed using these settings.