News:

Wondering if this will always be free?  See why free is better.

Main Menu

Resample Big Attached Images

Started by Naturforum, January 11, 2006, 12:33:17 PM

Previous topic - Next topic

Jaba

Thanx for the reply. I think (I hope) my problem isn't as bad as you think it might be! I don't think it is!

This might just be a problem with my install but this version doesn't work for me either!
When I install this MOD I 100% can not post an image, Gallery is fine as I guess not related as it handles images on its own!

When I remove the MOD once again I can post images! I can post and attach a new image or the image that was failing before, when the MOD was live!
I can also attach the same image that was failing to upload before to the old post that failed image upload when the MOD was live!

I've tried many different image files but the results are always the same!

FYI; My error log:

2: rename(/tmp/phpMsdRWm_resized,/tmp/phpMsdRWm) [<a href='function.rename'>function.rename</a>]: No such file or directory
File: /home/sites/my-web-site/public_html/forum/Sources/Post.php
Line: 1518

2: filesize() [<a href='function.filesize'>function.filesize</a>]: Stat failed for /tmp/phpMsdRWm_resized (errno=2 - No such file or directory)
File: /home/sites/my-web-site/public_html/forum/Sources/Post.php
Line: 1509

2: imagejpeg(): supplied argument is not a valid Image resource
File: /home/sites/my-web-site/public_html/forum/Sources/Post.php
Line: 1506

2: imagecopyresampled(): supplied argument is not a valid Image resource
File: /home/sites/my-web-site/public_html/forum/Sources/Post.php
Line: 1504

2: imagecreatetruecolor() [<a href='function.imagecreatetruecolor'>function.imagecreatetruecolor</a>]: Invalid image dimensions
File: /home/sites/my-web-site/public_html/forum/Sources/Post.php
Line: 1503
------------------------

Anyway, this is not urgent but I would like the MOD to work as it would be good to have more control what is uploaded etc!

Thanx for any info, but like I said it's not urgent.


TrueSatan

Your first two error log entries suggest a misconfiguration of the server by your host...specifically it looks like there is no tmp (temp) directory and thus the mod can't work (I would think that other uses of image resizing would also fail as this mod uses a standard system on the server.)

Unfortunately there's nothing you can do save for asking your host to fix it...once I saw your error log it did make things a lot more clear. My sympathies...

Eva

I downloaded your updated 1.1.3 version but when I tried installing it to SMF1.1.4 I get a file corrupt or not compatible version error...

Have you tested it with SMF1.1.4?

Goad


Rövarn


Rövarn

#45
Quote from: Matthew Schenker on March 05, 2007, 09:15:16 AM
This is a useful modification.

But does anyone know if there is a modification available that will resize attachments automatically?  I mean, one that reduces the KB size.  This would be really useful.

This one does on my forum!

I upload a .jpg picture 1280 x 960, 778 KB, when uploaded in my forum it is 35.43 KB, 800x600

Very useful, thank you!

denzil69

i couldnt install this mod using 1.1.4 on default theme.
i changed the code in the zip file (uninstall/install) as instructed in earlier post.

it installed no problem.
but when i use the gallery now and upoload pictures, it has no effect at all and still displays the picture in a size larger than the browser window.

any ideas please?

Macallan

Hi,

wonderful extension, it works fine with version 1.1.5 with new posts (no previous ones).

Great job!

cortez

#48
I am using 1.1.5 and it worked fine for around one week. It's set to 800x800 and now, when I click on thumbnail image is not appearing. But when I click on the name of image, it opens regularly on installed image viewer.

Solutions?

Example link:
http://autobusi.org/index.php?option=com_smf&Itemid=26&topic=1724

cortez


locau

Quote from: Macallan on May 06, 2008, 06:10:50 PM
Hi,

wonderful extension, it works fine with version 1.1.5 with new posts (no previous ones).

Great job!

Quote from: prljavi_bluzer on June 07, 2008, 12:26:14 PM
I am using 1.1.5 and it worked fine for around one week. It's set to 800x800 and now, when I click on thumbnail image is not appearing. But when I click on the name of image, it opens regularly on installed image viewer.

Solutions?

Example link:
http://autobusi.org/index.php?option=com_smf&Itemid=26&topic=1724

I'm using 1.1.5 and i can't seeem to get this to work, a little help pls ?
What mod have you download? What did you do to make it work ?

For me i get
QuoteThe package you are trying to download or install is either corrupt or not compatible with this version of SMF.

export!

#51
I'm using 1.1.7   I tried the mod - it seemed to install properly but when I tried to upload an attachment I got this error;

Fatal error: Call to undefined function: exif_imagetype() in /[path to sources]/Post.php on line 1481

Looks like Godaddy may not have the supporting packages I need.  ;(

export!

Weird though - now that I dug around a bit isn't exif_imagetype a normal "stock" part of php ??

Spuds

For those that are interested ....

I had a need for this code to help out with large images being uploaded to the site and then causing display format issues etc, etc ... Anyway I did a little refresh to the code that so far is working for me and suits my needs, YMMV

Changes are:
1) support for png and gif, the original code only had jpg support
2) maintains alpha and transparency for png and gifs
3) added quality option in admin panel, this is the amount of compression that is applied to jpg or png files
4) added sharpen function for jpg images, this improves the appearance when they get resized.  Its strength is adaptive so it sharpens based on the amount of resizing done.  This on/off option is available in the admin panel
5) added ability to turn on / off mod from admin panel
6) the options are added under the image width/height in the admin panel

I added basic checks for gd2 in the code so it should not error out if you don't have it installed.  You can check for yourself, look under admin/Support and Credits  ... under support information after server version you should see something like 'GD version: bundled (2.0.34 compatible)'  the key things are bundled and 2.xxx, without that its not going to work.  You also  need exif to determine the type of file.

Think that's it ... since I've only tested it with 1.1.8 that's what the installer will allow.

richard68

Mod seems to install fine, no errors but in the Admin panel I see the check boxes but no text to the left to know what they are for.  Last time something like this happened it was due to the language files, can you help?
Regards,
Rich

Spuds

Rich,

I can try ... The file that the package currently modifies is $themedir/languages/ModSettings.english.php, this is what should show up next to the check boxes.

If you are not using english, or if your langauge files are not in ModSettings.english.php then the text would not show up.  You need to add the following lines to your language file

$txt['image_quality'] = 'Quality of resized image';
$txt['image_sharpen_onresize'] = 'Sharpen on resize';
$txt['image_resize_onupload'] = 'Enable resize';


Likewise if you want the help pop up for those items you need to find the language help files.  Right now the package modifies $themedir/languages/Help.english.php by adding the following lines

$helptxt['image_quality'] = 'This sets the level of compression for jpg or png files, 100 is no compression, 0 is maximum.  A setting of 75 is recommended';
$helptxt['image_sharpen_onresize'] = 'This will sharpen the resized image (jpg only) to improve the quality but it will also increase the filesize';
$helptxt['image_resize_onupload'] = 'This enables resizing / resampling the image on upload only if either its width / height are above the limits';


cortez

For me it sometimes works, sometimes doesn't work. Why? No erros in forum error log, using 1.1.8 build made by Spuds couple of posts above.

And is there any way to resize already posted images?

ElectricSquid

Quote from: Spuds on March 16, 2009, 06:17:02 PM
For those that are interested ....

I had a need for this code to help out with large images being uploaded to the site and then causing display format issues etc, etc ... Anyway I did a little refresh to the code that so far is working for me and suits my needs, YMMV

Changes are:
1) support for png and gif, the original code only had jpg support
2) maintains alpha and transparency for png and gifs
3) added quality option in admin panel, this is the amount of compression that is applied to jpg or png files
4) added sharpen function for jpg images, this improves the appearance when they get resized.  Its strength is adaptive so it sharpens based on the amount of resizing done.  This on/off option is available in the admin panel
5) added ability to turn on / off mod from admin panel
6) the options are added under the image width/height in the admin panel

I added basic checks for gd2 in the code so it should not error out if you don't have it installed.  You can check for yourself, look under admin/Support and Credits  ... under support information after server version you should see something like 'GD version: bundled (2.0.34 compatible)'  the key things are bundled and 2.xxx, without that its not going to work.  You also  need exif to determine the type of file.

Think that's it ... since I've only tested it with 1.1.8 that's what the installer will allow.

Nice!!

To bad it doesn't load for 1.1.9
Is there a way you can list the file modifications so we can do a manual instal?

I'm trying to get it in there right now.
I figure that I can downgrade from 1.1.9 to 1.1.8
Then install your package
Then upgrade to 1.1.9 again

I'll let you know if it works.



Oh, any upcoming support for SMF 2.0 RC1.2 or above?
This is one of the reasons I was asking for the manual instal file edit data.
I might be able to hack it in there manually.

ElectricSquid

Yup, it worked on 1.1.9
Auto resized a pic that was 1.2M down to 48kb

I had to enable php_exif.dll and php_mbstring.dll, otherwise it gave a white screen after posting (no error in log, just white screen).

After enabling exif and mbstring, everything worked well.

OH, make sure you put enable: php_mbstring.dll before enable php_exif.dll in php.ini, otherwise it will not work. (it's not that way by default in php 5.2.6)
Mbstring needs to load before exif. Something about exif needs mbstring to already be loaded because exif depends on mbstring to load.

Oliver.Z

Hello,
I installed it on 1.1.11 and now I have the "White Screen Problem"
Can someone explain to me how I install the mbstring and exif on
Linux 2.6.18-028stab064.7 with PHP 5.2.9 ?

Thx Olli


Advertisement: