TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-31-2007, 05:12 PM   #1 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default 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.
Tanax is offline  
Reply With Quote
Old 10-31-2007, 05:21 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

What is the exact error that you're getting? Check with phpinfo() that the GD module has (or hasn't) been loaded.
Salathe is offline  
Reply With Quote
Old 10-31-2007, 05:25 PM   #3 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

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:
Quote:
You do not have the GD Library installed. This class requires the GD library to function properly. visit http://us2.php.net/manual/en/ref.image.php for more information
Tanax is offline  
Reply With Quote
Old 10-31-2007, 05:48 PM   #4 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

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.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 10-31-2007, 05:53 PM   #5 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

php.ini(in C:\wamp\Apache2\bin)
Quote:
;extension=php_gd2.dll
same place, same file:
Quote:
extension_dir = "c:/wamp/php/ext/"
It.. seems to be correct :S
Tanax is offline  
Reply With Quote
Old 10-31-2007, 06:00 PM   #6 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

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;
        } 
Tanax is offline  
Reply With Quote
Old 10-31-2007, 06:02 PM   #7 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Remove the semicolon from the beginning of that line in your php.ini.
Salathe is offline  
Reply With Quote
Old 10-31-2007, 06:35 PM   #8 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

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; 
Tanax is offline  
Reply With Quote
Old 10-31-2007, 06:55 PM   #9 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

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.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 10-31-2007, 07:35 PM   #10 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

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!!
Tanax is offline  
Reply With Quote
Old 10-31-2007, 08:16 PM   #11 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

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.
Salathe is offline  
Reply With Quote
Old 10-31-2007, 08:23 PM   #12 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Ah, I found it ;)

Thanks :D
Tanax is offline  
Reply With Quote
Old 10-31-2007, 08:53 PM   #13 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

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?
Tanax is offline  
Reply With Quote
Old 11-01-2007, 09:18 AM   #14 (permalink)
Super Moderator
Advanced Programmer 
 
bluesaga's Avatar
 
Join Date: Sep 2007
Posts: 165
Thanks: 0
bluesaga is on a distinguished road
Default

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?
__________________
Halo 3 Cheats
bluesaga is offline  
Reply With Quote
Old 11-01-2007, 12:17 PM   #15 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Okey, the images are around 5-7mb each.

I use this script:
http://www.gen-x-design.com/projects...bnailer-class/

Together with an own gallery class. It doesn't store files in an array, it just prints the images out.. eh, you can view the gallery here(without thumbnail script):

www.cumulustidning.se/bildbank/index.php

It's in swe though, but I think you can find your way around..
Tanax is offline  
Reply With Quote
Old 11-01-2007, 01:00 PM   #16 (permalink)
Super Moderator
Advanced Programmer 
 
bluesaga's Avatar
 
Join Date: Sep 2007
Posts: 165
Thanks: 0
bluesaga is on a distinguished road
Default

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.
__________________
Halo 3 Cheats
bluesaga is offline  
Reply With Quote
Old 11-01-2007, 01:31 PM   #17 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

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?
Salathe is offline  
Reply With Quote
Old 11-01-2007, 02:17 PM   #18 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Oh, no I haven't called it.. I'll change it and come back to you asap.

Thanks
Tanax is offline  
Reply With Quote
Old 11-01-2007, 02:34 PM   #19 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Nope it still uses 120.. :S
Tanax is offline  
Reply With Quote
Old 11-01-2007, 05:12 PM   #20 (permalink)
Super Moderator
Advanced Programmer 
 
bluesaga's Avatar
 
Join Date: Sep 2007
Posts: 165
Thanks: 0
bluesaga is on a distinguished road
Default

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 ( 
substrPHP_OS0) == '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.
__________________
Halo 3 Cheats
bluesaga is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:10 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design