 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
|
 |
|
 |
10-31-2007, 05:12 PM
|
#1 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Installing GD
Hi, I'm wondering why I get this error.
I'm using a thumbnail class, and it requires GD.
I've checked my php.ini and it's already including the php_gd2.dll extention, and I've checked that it exists in the extention folder.
So why doesn't it work? :S
I use WAMP btw.
|
|
|
|
10-31-2007, 05:21 PM
|
#2 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
What is the exact error that you're getting? Check with phpinfo() that the GD module has (or hasn't) been loaded.
|
|
|
|
10-31-2007, 05:25 PM
|
#3 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Quote:
Additional Modules
Module Name
Environment
|
Nope,hasn't been loaded :S:S
Actually it said this:
Quote:
|
Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"
|
Says gd something.. :P
Anyways, I've gotten this error:
|
|
|
|
10-31-2007, 05:48 PM
|
#4 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
Are the extensions in php.ini pointing to the correct location?
Are you editing the correct php.ini file? (For me: C:\wamp\Apache2\bin)
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|
10-31-2007, 05:53 PM
|
#5 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
php.ini(in C:\wamp\Apache2\bin)
same place, same file:
Quote:
|
extension_dir = "c:/wamp/php/ext/"
|
It.. seems to be correct :S
|
|
|
|
10-31-2007, 06:00 PM
|
#6 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Btw, this is the thing that is giving the errormsg:
PHP Code:
if(!function_exists("gd_info")) { echo 'You do not have the GD Library installed. This class requires the GD library to function properly.' . "\n"; echo 'visit http://us2.php.net/manual/en/ref.image.php for more information'; exit; }
|
|
|
|
10-31-2007, 06:02 PM
|
#7 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
Remove the semicolon from the beginning of that line in your php.ini.
|
|
|
|
10-31-2007, 06:35 PM
|
#8 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Okey! It's working now :D
But now I got this:
Quote:
|
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 1600 bytes) in C:\wamp\www\Gallery Class\class\thumbnail.inc.php on line 152
|
line 151,152,153:
PHP Code:
case 'JPG': $this->oldImage = ImageCreateFromJpeg($this->fileName); break;
|
|
|
|
10-31-2007, 06:55 PM
|
#9 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
Your JPEG will be too large, no doubt. Or you may be stuck in a loop.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|
10-31-2007, 07:35 PM
|
#10 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Yea but isn't there any way to remove the limit?
Cause some of the images that I need to resize is 4mb-7mb, and that's why I need to resize them, cause they're 2000+ px in width, takes ALOT of time to load!!
|
|
|
|
10-31-2007, 08:16 PM
|
#11 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
Your current memory (RAM) limit is set to 8MB, you can change the limit using the memory_limit in your php.ini file. Set it to "numberM", for example 50M would be 50 Megabytes of RAM.
|
|
|
|
10-31-2007, 08:23 PM
|
#12 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Ah, I found it ;)
Thanks :D
|
|
|
|
10-31-2007, 08:53 PM
|
#13 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Okey, so I had to change this to 120M to be able to view those images.
A simple question, if I were to put up this script on a webhotel, would this be sucking alot of bandwidth?
And if it does, would it be better if I were to simply load all the 2000px in width-pictures with no resizing?
|
|
|
|
11-01-2007, 09:18 AM
|
#14 (permalink)
|
|
Super Moderator
Join Date: Sep 2007
Posts: 165
Thanks: 0
|
It would not use much bandwidth, but it would be a killer for server resources if needed to be run on the fly... all the time!
How large are the images? 120Mb seems huge, but is definitely plausable.
The program isn't storing large amounts of files in arrays is it?
|
|
|
|
11-01-2007, 01:00 PM
|
#16 (permalink)
|
|
Super Moderator
Join Date: Sep 2007
Posts: 165
Thanks: 0
|
5-7mb would imply 5-7mb of memory used to manipulate the images. Thus you shouldn't need 120mb of memory available!
Sounds like some bad variable usage if your using that much memory.
|
|
|
|
11-01-2007, 01:31 PM
|
#17 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
This class comes in both PHP 4 and 5 flavors, but I highly recommend the PHP 5 version, due to the “__destruct()” function that became available in version 5. This helps ensure that you do not inadvertently create memory leaks by forgetting to call the “destruct()” function explicitly, like you must in the PHP 4 version of this script. If you're using PHP4, are you explicitly calling the destruct method?
|
|
|
|
11-01-2007, 02:17 PM
|
#18 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Oh, no I haven't called it.. I'll change it and come back to you asap.
Thanks
|
|
|
|
11-01-2007, 02:34 PM
|
#19 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Nope it still uses 120.. :S
|
|
|
|
11-01-2007, 05:12 PM
|
#20 (permalink)
|
|
Super Moderator
Join Date: Sep 2007
Posts: 165
Thanks: 0
|
Ok please:
1) Add
PHP Code:
<?php if( !function_exists('memory_get_usage') ) { function memory_get_usage() { //If its Windows //Tested on Win XP Pro SP2. Should work on Win 2003 Server too //Doesn't work for 2000 //If you need it to work for 2000 look at http://us2.php.net/manual/en/function.memory-get-usage.php#54642 if ( substr(PHP_OS,0,3) == 'WIN') { if ( substr( PHP_OS, 0, 3 ) == 'WIN' ) { $output = array(); exec( 'tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $output ); return preg_replace( '/[\D]/', '', $output[5] ) * 1024; } }else { //We now assume the OS is UNIX //Tested on Mac OS X 10.4.6 and Linux Red Hat Enterprise 4 //This should work on most UNIX systems $pid = getmypid(); exec("ps -eo%mem,rss,pid | grep $pid", $output); $output = explode(" ", $output[0]); //rss is given in 1024 byte units return $output[1] * 1024; } } } ?>
To the top of your code, either in an include or at the very top (the IF statement requires that it is at the top)....
2) Before and After every image resize, use the function above and echo the output of it. This should give an indicator of where the problems within your script are.
Note: I mean the script you are using to run the class that resizes the image.
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|