View previous topic :: View next topic |
Author |
Message |
Joseph
Joined: 28 Oct 2002 Posts: 27 Location: Waterloo, Canada
|
Posted: Sun Nov 03, 2002 3:21 pm Post subject: Automatically generate a thumbnail when uploading an image |
|
|
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 |
|
 |
Joseph
Joined: 28 Oct 2002 Posts: 27 Location: Waterloo, Canada
|
Posted: Fri Nov 08, 2002 9:21 am Post subject: Screenshots |
|
|
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 |
|
 |
kaiser
Joined: 09 Nov 2002 Posts: 1
|
Posted: Sat Nov 09, 2002 5:13 pm Post subject: |
|
|
Very impressive!!! And very useful!!!
Many thanks!!
bye  |
|
Back to top |
|
 |
Tanner
Joined: 06 Jul 2002 Posts: 55 Location: Germany
|
Posted: Sat Nov 09, 2002 8:31 pm Post subject: |
|
|
really cool! :!: |
|
Back to top |
|
 |
Joseph
Joined: 28 Oct 2002 Posts: 27 Location: Waterloo, Canada
|
Posted: Sun Nov 10, 2002 8:39 am Post subject: Wow - someone actually appreciates it ;) |
|
|
I was wondering if anyone was actually going to use this. Thanks for the feedback. |
|
Back to top |
|
 |
Cine
Joined: 22 Sep 2002 Posts: 22 Location: Lost
|
Posted: Sun Nov 10, 2002 11:39 am Post subject: |
|
|
I may use it later! Really cool hack! |
|
Back to top |
|
 |
Tanner
Joined: 06 Jul 2002 Posts: 55 Location: Germany
|
Posted: Sun Nov 10, 2002 7:46 pm Post subject: |
|
|
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 |
|
 |
imeridian
Joined: 12 Feb 2002 Posts: 191
|
Posted: Sun Nov 10, 2002 10:08 pm Post subject: |
|
|
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 |
|
 |
.Chris
Joined: 30 Apr 2002 Posts: 186 Location: Hawaii
|
Posted: Mon Nov 11, 2002 3:36 am Post subject: |
|
|
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  |
|
Back to top |
|
 |
Joseph
Joined: 28 Oct 2002 Posts: 27 Location: Waterloo, Canada
|
Posted: Mon Nov 11, 2002 4:40 pm Post subject: To Tanner |
|
|
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 |
|
 |
Tanner
Joined: 06 Jul 2002 Posts: 55 Location: Germany
|
Posted: Mon Nov 11, 2002 7:14 pm Post subject: |
|
|
oh, yes - thanxx a lot! |
|
Back to top |
|
 |
Garfizh
Joined: 03 Jul 2002 Posts: 28
|
Posted: Sat Dec 28, 2002 8:04 am Post subject: |
|
|
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 |
|
 |
Graam
Joined: 20 Dec 2002 Posts: 134
|
Posted: Sat Dec 28, 2002 10:41 pm Post subject: |
|
|
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 |
|
 |
macshack
Joined: 17 Jul 2002 Posts: 1204 Location: Phoenix, Az
|
Posted: Sun Dec 29, 2002 1:23 am Post subject: |
|
|
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 |
|
 |
Graam
Joined: 20 Dec 2002 Posts: 134
|
Posted: Sun Dec 29, 2002 12:31 pm Post subject: |
|
|
I got
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 |
|
 |
|