|
Mindcontroll
|
View previous topic :: View next topic |
Author |
Message |
Shn
Joined: 10 Feb 2002
Posts: 738
|
Posted: 06-25-2002 11:39 AM Post subject: php and image resizing |
|
|
I was wondering how i could create a thumbnail of pics.
The pics are in the folder root/pics.
The thumbnails would be in root/pics/thumbnails.
now, i've read about imageCopyResized function.
But it doesn't seem to work on my server and i've got no idea why.
So, if there's a way to recreate this function, or any other way to create thumbnails, i'd like to know.
(These thumbnails would be created when the pics are uploaded.)
Yes, it's for the imagearchive thing. |
|
Back to top |
|
TuMTuM
Joined: 17 Feb 2002
Posts: 425
|
Posted: 06-29-2002 02:57 AM Post subject: |
|
|
Try using apache and php first, maybe that helps, but since Im making a site for my dad and it has to be complete on friday, I cant really try. If youre stuck, try looking at the sources on http://www.hotscripts.com cause they have some of those scripts for sure. |
|
Back to top |
|
Shn
Joined: 10 Feb 2002
Posts: 738
|
Posted: 06-29-2002 08:03 AM Post subject: |
|
|
k thanks, i already looked at a few scripts on other sites.
I guess i just have to think a little to find out, as it doesn't look too difficult... |
|
Back to top |
|
js995
Joined: 10 Feb 2002
Posts: 226
|
Posted: 09-21-2002 08:13 AM Post subject: |
|
|
if you are still doing this, you should look into the GD library.
THIS MUST BE INSTALLED TO MANIPULATE GRAPHICS IN PHP ! ..
the function that is probably most use for this is ... (syntax)
int ImageCopyResized(int dst_im, int src_im, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, intsrcH);
so .. um .. to make a image twice as small as it is at the moment ..
<?php
$size = GetImageSize("theexistingimage.gif");
$im_in = ImageCreateFromGif("theexistingimage.gif");
$im_out = ImageCreate($size[0] / 2, $size[1] /2);
$ImageCopyResized ($im_out, $im_in, 0, 0, 0, 0, $size[0] / 2, $size[1] / 2, $size[0], $size[1]);
ImageGif($im_out, "outputthumbnail.gif");
ImageDestroy($im_in);
ImageDestroy($im_out);
?>
Disclaimer : Havent tested this..
if you have any more questions e-mail me,
js
btw, if its just a a server problem, php can be added to with the GD as following ...
C:\php\extensions>dir *gd*
Directory of C:\php\extensions
06/09/2002 10:50 AM 471,040 php_gd.dll
06/09/2002 11:02 AM 659,456 php_gd2.dll
php 4.2.3 / apache 2.0.40
then uncomment
;extension=php_gd.dll
(on my system: around line 456 of php.ini, using recommended)
or change it to php_gd2 if you need the extra functions |
|
Back to top |
|
Shn
Joined: 10 Feb 2002
Posts: 738
|
Posted: 09-21-2002 11:49 AM Post subject: |
|
|
Hmmm hi js, nice to see you again :)
Now that's an old thread, and as you can maybe see in the image archive, i found out the answer, and i do use the GD library to resize images... I could make it better (including quality...)... but i'm lazy :D
K, end.
Oh and thanks for your help :) |
|
Back to top |
|
|
|