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 03-11-2009, 06:18 PM   #1 (permalink)
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Default Resizing Large Images With PHP GD

Through working on a few websites that allow users to upload their own images I have run into a problem. The image files may upload, but if they are over 1000px tall/wide then they will not resize. PHP just stops the script and leaves the user with a blank page.

I've gotten around this issue by simply telling users not to upload photos larger than 1000px, but I was hoping there was an alternate solution. Is this a problem with GD, or do I need to change a setting in php.ini?
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne is offline  
Reply With Quote
Old 03-11-2009, 11:00 PM   #2 (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

You need to change the settings in the php.ini.
I don't know exactly which setting, but it's something that has to do with the memory.

Currently your php is taking up too much memory while resizing, causing it "overload"(or something), and that's why it's not working.
__________________
Tanax is offline  
Reply With Quote
Old 03-11-2009, 11:54 PM   #3 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,381
Thanks: 5
Salathe is on a distinguished road
Default

memory_limit's value can be set "anywhere": http.conf, php.ini, .htaccess or at runtime with ini_set(). (The latter probably being preferable.)

There are also various techniques which can be used to best utilise memory when manipulating images, but they only go so far and there's no magic recipe.
Salathe is offline  
Reply With Quote
Old 03-12-2009, 04:33 PM   #4 (permalink)
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Default

Thanks Tanax and Salathe! I'm gonna experiment a bit with PHP's memory usage settings and see if that fixes it.
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cropping Images using PHP Rendair Advanced PHP Programming 22 05-17-2012 10:22 AM
10 PHP Myths Dispelled Wildhoney General 9 06-15-2009 06:55 AM
Sliced Images not working in php site Kay1021 XHTML, HTML, CSS 5 06-03-2008 06:40 PM
Resize/Thumbnail Images With PHP danielneri Script Giveaway 4 01-11-2008 12:10 PM
Large PHP Site List - Post additions AlEast Absolute Beginners 3 04-13-2005 05:10 PM


All times are GMT. The time now is 04:22 PM.

 
     

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