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

Naturforum

Link to Mod

If attached image has physical dimensions larger than what is allowed ("Max width/height of posted pictures" on page "Basic Features"), this mod will automatically and permanently resample (shrink) the stored image file so it fits within the maximum dimension limits.

I.e. if the limits are 800x800 pixels and the attached image is 3200x2400 it will be resized to 800x600.

This can greatly reduce the storage space required on the server, without forcing the users to shrink the images themselves.

NB: THIS MOD CURRENTLY REQUIRES GD2 SUPPORT!

NB2: THIS HAS ONLY BEEN TESTED ON A CLEAN INSTALL OF SMF 1.1 RC 1/2
Naturforum

evillair

You wouldn't have a 1.0.5 compatible version? :)

DrilLer

Fatal error: Call to undefined function: exif_imagetype() in /home1/hosting/www.bnet.by/forum/Sources/Post.php on line 1455

e03179

I'm giving it a spin.  I've needed something like this.
HALO2 PC.org [nofollow]
[nofollow]

Naturforum

Quote from: evillair on January 13, 2006, 10:45:22 PM
You wouldn't have a 1.0.5 compatible version? :)

Sorry, no.
I have not tried 1.0.5 myself. But I would assume it would be quite easy to adapt to other versions. Download 1.1RC2, take a look at my mod file, at the file it modifies, and at the 1.0.5 version of that file. Maybe you'll be able to make it 1.0.5 compatible.
Naturforum

Naturforum

#5
Quote from: DrilLer on January 14, 2006, 06:41:08 AM
Fatal error: Call to undefined function: exif_imagetype() in /home1/hosting/www.bnet.by/forum/Sources/Post.php on line 1455

This mod has only been tested on a clean install of SMF 1.1 RC1/2, on a server supporting various graphics related functions.

My first guess would be that the PHP-installation on your server has not been compiled with exif-support.

Check this using phpinfo(). Look for the string "--enable-exif" in "Configure Command".

If this is not present the mod will probably not work.
Naturforum

xtremecruiser

Worked fine after I set the limits to 800x800 pixels, would not work with 800x600 ???
On a upgraded forum SMF 1.1 RC2

Bigguy

If you already have images on your forum will it resize them as well ??? or will it just resize new images that have been put on the forum since the mod was installed.

xtremecruiser

Quote from: Bigguy on January 17, 2006, 10:49:32 PM
If you already have images on your forum will it resize them as well ??? or will it just resize new images that have been put on the forum since the mod was installed.
Only the ones you UL after the mod, at least on mine

Bigguy


gravy

Quote from: evillair on January 13, 2006, 10:45:22 PM
You wouldn't have a 1.0.5 compatible version? :)

I changed the package-info.xml codes a little like so:
<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
<id>resample_big_attached_images</id>
<name>Resample Big Attached Images</name>
<version>0.1</version>
<type>modification</type>
<install for="1.1 RC1, 1.1 RC2, 1.1">
  <readme type="inline">Install mod Resample Big Attached Images</readme>
  <modification format="boardmod" type="file">resample_big_attached_images.mod</modification>
</install>
<uninstall for="1.1 RC1, 1.1 RC2, 1.1">
  <readme type="inline">Thanks for trying out this mod.</readme>
  <modification format="boardmod" type="file" reverse="true">resample_big_attached_images.mod</modification>
</uninstall>
</package-info>


to:

<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
<id>resample_big_attached_images</id>
<name>Resample Big Attached Images</name>
<version>0.1</version>
<type>modification</type>
<install for="1.1 RC1, 1.1 RC2, 1.0.5">
  <readme type="inline">Install mod Resample Big Attached Images</readme>
  <modification format="boardmod" type="file">resample_big_attached_images.mod</modification>
</install>
<uninstall for="1.1 RC1, 1.1 RC2, 1.0.5">
  <readme type="inline">Thanks for trying out this mod.</readme>
  <modification format="boardmod" type="file" reverse="true">resample_big_attached_images.mod</modification>
</uninstall>
</package-info>

Uploaded the package and everything worked fine! Even resized all of my attachments from previous posts. Hope it helps ya out.

xtremecruiser

Seems just a mod so it works with 1.05
It resized all your old UL's too ?
I installed it on 2 different forums and it did not resize the old UL's ???

Quote from: gravy on January 23, 2006, 12:23:27 AM
Quote from: evillair on January 13, 2006, 10:45:22 PM
You wouldn't have a 1.0.5 compatible version? :)

I changed the package-info.xml codes a little like so:
<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
<id>resample_big_attached_images</id>
<name>Resample Big Attached Images</name>
<version>0.1</version>
<type>modification</type>
<install for="1.1 RC1, 1.1 RC2, 1.1">
  <readme type="inline">Install mod Resample Big Attached Images</readme>
  <modification format="boardmod" type="file">resample_big_attached_images.mod</modification>
</install>
<uninstall for="1.1 RC1, 1.1 RC2, 1.1">
  <readme type="inline">Thanks for trying out this mod.</readme>
  <modification format="boardmod" type="file" reverse="true">resample_big_attached_images.mod</modification>
</uninstall>
</package-info>


to:

<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
<id>resample_big_attached_images</id>
<name>Resample Big Attached Images</name>
<version>0.1</version>
<type>modification</type>
<install for="1.1 RC1, 1.1 RC2, 1.0.5">
  <readme type="inline">Install mod Resample Big Attached Images</readme>
  <modification format="boardmod" type="file">resample_big_attached_images.mod</modification>
</install>
<uninstall for="1.1 RC1, 1.1 RC2, 1.0.5">
  <readme type="inline">Thanks for trying out this mod.</readme>
  <modification format="boardmod" type="file" reverse="true">resample_big_attached_images.mod</modification>
</uninstall>
</package-info>

Uploaded the package and everything worked fine! Even resized all of my attachments from previous posts. Hope it helps ya out.

Naturforum

Quote from: xtremecruiser on January 23, 2006, 06:12:54 PM
Seems just a mod so it works with 1.05
It resized all your old UL's too ?
I installed it on 2 different forums and it did not resize the old UL's ???

I have not tested it on 1.0.5 so if it works there without altering it's just by luck..  ;D

To my knowledge it does not affect existing images, only the ones uploaded subsequent to installing the mod.
Naturforum

mediman

Quote from: Naturforum on January 15, 2006, 04:39:44 AM
This mod has only been tested on a clean install of SMF 1.1 RC1/2, on a server supporting various graphics related functions.

My first guess would be that the PHP-installation on your server has not been compiled with exif-support.

Check this using phpinfo(). Look for the string "--enable-exif" in "Configure Command".

If this is not present the mod will probably not work.


has nothing to do with php or exif. the problem is that this mod uses the exif infos to check the images sizes and not all images have this infos.

it would be quite better to use the inbuild gd2 function to check the width and height of an image.

mediman
My Projects: http://ticker-oase.de 
Please do not PM me with support requests.

ccondrup

Hello, I am also receiving that same error (undefined function: exif_imagetype()), and I know my host has both GD2 and Exif support, but I noticed php has not been compiled --enable-exif. I am not sure whether another method has been used, but see these screens that show exif and gd is enabled:

What mediman says here makes sense - but is someone willing to look into it and maybe update this mod with a more clever version of checking attached images, and also update for Rc3 while at it?

I would guess there are lots of administrators out there that have limited webspace and still would like to offer uploading to users...  Digital cameras keeps on delievering larger and larger images, and users put the originals up on the forums.... gargh... please help, thanks!

kriskd

Is this compatible with 1.1.1 and how can we determine if we have GD2 support?
SMF 2.0.2

Stirred

I manage to put it working with 1.1.1 with 1024x1024, but i still get some errors:

Quote2: exif_imagetype(post_tmp_791_2) [<a href='function.exif-imagetype'>function.exif-imagetype</a>]: failed to open stream: No such file or directory
Ficheiro: /home/hentaip/public_html/Sources/Post.php
Linha: 1495

and

Quote2: imagesx(): supplied argument is not a valid Image resource
Ficheiro: /home/hentaip/public_html/Sources/Post.php
Linha: 1506

Would be nice if anyone could fix those errors. But apparently it doesn´t has any problems besides appearing on error log.
- eighteen seconds before sunrise -

xtremecruiser

#17
Just go into the package-info.xml file and add 1.1.1 to 2 lines
<install for="1.1 RC1, 1.1 RC2, 1.1, 1.1.1, 1.1.2 ">
<uninstall for="1.1 RC1, 1.1 RC2, 1.1, 1.1.1, 1.1.2">

and it works fine

Updated to work with 1.1.2 ( just make the chages above )

BjornB

Doesn't work with 1.1.2.

Any chance for an updated version? Would really appreciate it.

Bjorn

TrueSatan

 The mod is very general purpose as regards SMF versions and just needed an alteration to the package XML...the mod is now tested on 1.1.2 and works properly...assuming all the previous caveats in earlier postings are covered.

I would expect that it would be easy to keep it up to date unless the associated SMF files change drastically and, unless anyone objects, I'll probably post uprated versions as new SMF versions become available...I might do some modifications to the code as well but don't count on that as for my own use it's fine as it is.

If the developer wants me to do so I'll look after this mod...that's up to him though.

The version below adds support for SMF 1.1.1 and 1.1.2

Advertisement: