boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Automatically generate a thumbnail when uploading an image
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
Joseph



Joined: 28 Oct 2002
Posts: 27
Location: Waterloo, Canada

PostPosted: Sun Nov 03, 2002 3:21 pm    Post subject: Automatically generate a thumbnail when uploading an image Reply with quote

When you upload an image using the upload dialog, there is a button to automatically add the image to your post. This mod also creates a link to generate a thumbnail.

The thumbnail image is defined by $thumbnail_width and $thumbnail_height in the config file, and after generation there is an option to put the thumbnail (linking to the original image) in your post.

It hasn't be rigorously tested, but here is v. 1.0

http://www.redpointlife.com/joseph/b2upload.php.txt

I'll post screenshots at some point. Feedback welcome.


Last edited by Joseph on Mon Jun 09, 2003 11:36 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Joseph



Joined: 28 Oct 2002
Posts: 27
Location: Waterloo, Canada

PostPosted: Fri Nov 08, 2002 9:21 am    Post subject: Screenshots Reply with quote

As I promised.

After you upload an image, this is the window you are presented with.


If you click the "Generate Thumbnail" button, you are then given.


Last edited by Joseph on Mon Jun 09, 2003 11:37 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
kaiser



Joined: 09 Nov 2002
Posts: 1

PostPosted: Sat Nov 09, 2002 5:13 pm    Post subject: Reply with quote

Very impressive!!! And very useful!!!

Many thanks!!
bye Cool Very Happy
Back to top
View user's profile Send private message
Tanner



Joined: 06 Jul 2002
Posts: 55
Location: Germany

PostPosted: Sat Nov 09, 2002 8:31 pm    Post subject: Reply with quote

really cool! :!:
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Joseph



Joined: 28 Oct 2002
Posts: 27
Location: Waterloo, Canada

PostPosted: Sun Nov 10, 2002 8:39 am    Post subject: Wow - someone actually appreciates it ;) Reply with quote

I was wondering if anyone was actually going to use this. Thanks for the feedback.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Cine



Joined: 22 Sep 2002
Posts: 22
Location: Lost

PostPosted: Sun Nov 10, 2002 11:39 am    Post subject: Reply with quote

I may use it later! Really cool hack!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
Tanner



Joined: 06 Jul 2002
Posts: 55
Location: Germany

PostPosted: Sun Nov 10, 2002 7:46 pm    Post subject: Reply with quote

Houston, we have a problem:

Code:

Warning: ImageCreateFromGif: No GIF read support in this PHP build in /home/www/web243/html/playground/b2upload.php on line 215

Warning: Division by zero in /home/www/web243/html/playground/b2upload.php on line 227

Warning: Division by zero in /home/www/web243/html/playground/b2upload.php on line 227

Warning: Division by zero in /home/www/web243/html/playground/b2upload.php on line 230

Warning: Supplied argument is not a valid Image resource in /home/www/web243/html/playground/b2upload.php on line 230

Warning: ImageGif: No GIF create support in this PHP build in /home/www/web243/html/playground/b2upload.php on line 237

Thumbnail Generated

Your file thumb_entwurf3_01.gif was generated successfully !

Here's the code to display it:
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
imeridian



Joined: 12 Feb 2002
Posts: 191

PostPosted: Sun Nov 10, 2002 10:08 pm    Post subject: Reply with quote

Only the very ancient versions of GD, which is what php uses to work with images, have support for GIF files because of the licensing issues. This isn't a problem with the script, it's a problem with the bastids at unisys. ;) You simply cannot work with GIF files with GD anymore.
_________________
-indi<br>
http://indiboi.com
http://artlikepornstars.com
http://www.positivefusion.com
Back to top
View user's profile Send private message Visit poster's website
.Chris



Joined: 30 Apr 2002
Posts: 186
Location: Hawaii

PostPosted: Mon Nov 11, 2002 3:36 am    Post subject: Reply with quote

I'm using the script right and it works great. I haven't uploaded and posted any thumbnail images but I've tested it.

Thanks for the hack Smile
Back to top
View user's profile Send private message Visit poster's website
Joseph



Joined: 28 Oct 2002
Posts: 27
Location: Waterloo, Canada

PostPosted: Mon Nov 11, 2002 4:40 pm    Post subject: To Tanner Reply with quote

What imeridian said holds true - which explains the
Code:
Warning: ImageCreateFromGif: No GIF read support in this PHP build in /home/www/web243/html/playground/b2upload.php on line 215

and

Warning: Supplied argument is not a valid Image resource in /home/www/web243/html/playground/b2upload.php on line 230

Warning: ImageGif: No GIF create support in this PHP build in /home/www/web243/html/playground/b2upload.php on line 237


errors,

but the
Code:
Warning: Division by zero in /home/www/web243/html/playground/b2upload.php on line 227

Warning: Division by zero in /home/www/web243/html/playground/b2upload.php on line 227

Warning: Division by zero in /home/www/web243/html/playground/b2upload.php on line 230
errors most likely come from you neglecting to define $thumbnail_height and $thumbnail_width in your b2config.php file.

Lines 227 and 230 are
Code:
if (($img_data[0]/$thumbnail_width) > ($img_data[1]/$thumbnail_height))

and

imagecopyresized ($dest_img, $img, 0, 0, 0,0, $thumbnail_width, $thumbnail_height, $img_data[0], round ((($img_data[0]/$thumbnail_width) * $thumbnail_height),0) );

respectively.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Tanner



Joined: 06 Jul 2002
Posts: 55
Location: Germany

PostPosted: Mon Nov 11, 2002 7:14 pm    Post subject: Reply with quote

oh, yes - thanxx a lot!
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Garfizh



Joined: 03 Jul 2002
Posts: 28

PostPosted: Sat Dec 28, 2002 8:04 am    Post subject: Reply with quote

Is it possible to have a ratio width and height for the thumbnail? Like instead of setting a value of 100 for width and 65 for height, i could have a ratio of 40% of the image width and 40% of the image height.

This will make the thumbnail more visible especially since we sometimes have image that have width lesser than height and sometimes width higher than the height.
Back to top
View user's profile Send private message
Graam



Joined: 20 Dec 2002
Posts: 134

PostPosted: Sat Dec 28, 2002 10:41 pm    Post subject: Reply with quote

Code:
Fatal error: Call to undefined function: imagecreatefromjpeg() in /usr/local/psa/home/vhosts/teenangst.co.uk/httpdocs/b2upload.php on line 219


Any ideas? php newbie here...
Back to top
View user's profile Send private message Visit poster's website
macshack



Joined: 17 Jul 2002
Posts: 1204
Location: Phoenix, Az

PostPosted: Sun Dec 29, 2002 1:23 am    Post subject: Reply with quote

Hi,

My guess is the GD library is not configured with php. Run the phpinfo.php script located in the b2-tools directroy. Then see if the GD stuff is loaded. Again, my guess is that it is not.

michael e
Back to top
View user's profile Send private message Send e-mail
Graam



Joined: 20 Dec 2002
Posts: 134

PostPosted: Sun Dec 29, 2002 12:31 pm    Post subject: Reply with quote

I got
Code:
'--without-gd'


I'm guessing this means its not configured?
And I'm also guessing I need to email my host to get this set up?

Here's the phpinfo since I don't really know what I'm looking for...
http://www.teenangst.co.uk/b2-tools/phpinfo.php
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group