News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

[Solved] Upload/resize of jpeg avatars not working rc2

Started by safetythird, February 01, 2006, 01:28:52 PM

Previous topic - Next topic

safetythird

This is probably not a bug as I haven't been able to find anyone else having this issue.

smf 1.1rc2
apache2
php5
gd bundled (2.0.28 compatible)

When I try to upload an jpeg avatar that is larger than  the 65x65 limit nothing happens. No picture is uploaded to the attachments dir and no errors are given. When I try to upload a png larger than 65x65 I get this error:

Fatal error: Call to undefined function imagejpeg() in /home/xxx.com/forum/smf/Sources/Subs-Graphics.php on line 317

Gif files are fine except I don't think it resizes animated gifs correctly. Not a problem to me.

I'm guessing this is caused by a problem with my version of gd, most likely not compiled with jpeg support. I run Gallery2 on the same server and have it configured to use ImageMagik and it resizes pics just fine. Is it possible to hack Subs-Graphics to use a different image processing lib or is there a work around for us with lame gd's? Which version of GD should be installed if I have to end up upgrading it (and possibly breaking other stuff).

Any nudges in the right direction appreciated.

Thanks!




kegobeer

That's the latest GD/PHP bundled version.  Just ask your host to recompile PHP with jpeg support.  I'm certain a hack can be done to use ImageMagick instead of GD.  I'll look into it in the next few days.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

safetythird

#2
Recompliling did the trick.

A note to FreeBSD 6.0 users - The port of php5 bundles gd but does not enable jpeg, png or freetype support by default. It also has a disable-all in the configuration make file. Make sure you edit /usr/ports/lang/php5/Makefile to enable things like mysql and ftp then edit /usr/ports/lang/php5/Makefile.ext to give extra parameters to the gd build.

Example changes: Makefile
CONFIGURE_ARGS= --enable-versioning \
                --enable-memory-limit \
                --with-layout=GNU \
                --with-config-file-scan-dir=${PREFIX}/etc/php \
                --with-mysql \
                --with-xpm \
                --with-imap-ssl \
                --with-zlib \
                --with-zip \
                --enable-magic-quotes \
                --enable-memory-limit \
                --enable-ftp \
                --enable-mbstring \
                --enable-libxml \
                --with-libxml-dir=${LOCALBASE} \
                --enable-reflection \
                --enable-spl


and Makefile.ext
CONFIGURE_ARGS+=--with-gd \
                --with-freetype-dir=/usr/local/include/freetype2 \
                --with-jpeg-dir=/usr/local/lib/ \
                --with-png-dir=/usr/local/include/libpng \
                --with-zlib-dir=/usr/include


I still think it would be cool to have a way to use ImageMagik instead of GD for jpeg support. I think it would help those whos host won't or can't rebuild gd with jpeg support.

Anyways this is here for future reference should someone else need help.




Edited to correct wrong path to Makefile.ext

kegobeer

Thanks for reporting back.

Quote from: safetythird on February 01, 2006, 03:28:14 PM
I still think it would be cool to have a way to use ImageMagik instead of GD for jpeg support. I think it would help those whos host won't or can't rebuild gd with jpeg support.

Unfortunately, it also means a slew of ImageMagick support questions (how to install, why doesn't ImageMagick work, etc) that are best asked elsewhere.  Oh well, I'll still look into using ImageMagick.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

safetythird

#4
I can see where this could be a support headache.

Just a suggestion though, perhaps during install a function could test gd's ability to work on jpg files. I was able to install just fine even though my gd wasn't up to par. If it passes set a variable to use GD. If it fails, test to see if ImageMagik is installed and working. If it is then set the variable to use ImageMagik. If the IM test fails warn the user that image resizing won't be available. Then when image manipulating is needed the smf functions know which one to use. I suppose this would mean that new functions to use imagemagik would need to be written and implemented along with the install gd checker.

Not a big deal, just throwing it out there.

Now to figure out how to watermark uploaded images with [©]username to discourage image theft.

Cheers and keep up the good work!

Advertisement: