473,654 Members | 3,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memory exhausted

Hi,

I'm trying to resize a pic with the Code pasted below and get following
Error, why, how to resize it correctly???
src:
http://www.rideon.ch/php/gallerytest...PG&x=100&y=100
Error: <br />
<b>Fatal error</b>: Allowed memory size of 8388608 bytes exhausted at
(null):0 (tried to allocate 9088 bytes) in
<b>/srv/www/htdocs/web2/html/php/gallerytest/resizePic.php</b> on line
<b>39</b><br />

Source:
<?php
header("Content-type: image/jpeg");
header("Content-Disposition: inline; filename=\"". $src . "");

if (isset($x))
$detail_max_x=$ x;
else
$detail_max_x = 300;

if (isset($y))
$detail_max_y=$ y;
else
$detail_max_y = 300;

$type = "jpg";

// Orginalbild
$pic=$src;

// Bilddaten feststellen
$size=getimages ize($pic);
$faktor_y=$size[0]/$detail_max_y;
$faktor_x=$size[1]/$detail_max_x;

$breite = $size[0];
$hohe = $size[1];

// Verkleinerungsf aktor / Vergrösserungsa faktor
if($faktor_y < $faktor_x)
{ $sfaktor = $faktor_x; }
else
{ $sfaktor = $faktor_y; }

$neueBreite=int val($size[0]/$sfaktor);
$neueHoehe=intv al($size[1]/$sfaktor);
//JPG ausgabe
$altesBild=Imag eCreateFromJPEG ($pic);
$neuesBild=Imag eCreate($neueBr eite,$neueHoehe );
ImageCopyResize d($neuesBild,$a ltesBild,0,0,0, 0,$neueBreite,$ neueHoehe,$brei te,$hohe);
//$info = getimagesize($n euesBild);
//$farbe_b = imagecoloralloc ate($neuesBild, 10,36,106);
//imagerectangle( $neuesBild,1,1, $info[0]-1,$info[1]-1,$farbe_b);
Imagejpeg($neue sBild);
?>

Thank you very much!!!!
--
roN
www.rideon.ch
Jul 17 '05 #1
3 2238
Ron Eggler wrote:
I'm trying to resize a pic with the Code pasted below and get
following Error, why, how to resize it correctly???


Your version of PHP is probably compiled with memory limit support, which
defaults to 8M. Just increase the allowed memory (e.g. by adjusting the
memory_limit directive in your php.ini file to 16M) and it will work fine.
JW

Jul 17 '05 #2
Janwillem Borleffs wrote:
Ron Eggler wrote:
I'm trying to resize a pic with the Code pasted below and get
following Error, why, how to resize it correctly???
Your version of PHP is probably compiled with memory limit support,
which defaults to 8M. Just increase the allowed memory (e.g. by
adjusting the memory_limit directive in your php.ini file to 16M) and
it will work fine.


had to set it to 32M... :| seems like there is anything bad.... but what?

JW


--
roN
www.rideon.ch
Jul 17 '05 #3
Ron Eggler wrote:
had to set it to 32M... :| seems like there is anything bad.... but
what?


Well, JPEG-images *are* 24-bit bitmaps. So an image at size of
3000x3000 pixels *will* require 25.7MB of memory. In your script, the
memory required to finish the script depends on the size of $altesBild
(because it *gets* loaded into memory) even though $neuesBild would
only be quite small.

--
Markku Uttula

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
12356
by: Paul | last post by:
Hi, I'm using TikiWiki and was using its file upload feature, trying to upload a 2MB file. I get this error: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 1677706 bytes) in /var/html/www/tiki/lib/filegals/filegallib.php on line 30 Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
5
2209
by: Aaron Birkland | last post by:
I have a long but straightforward query (on some very large tables) that always ends in 'Memory exhausted in AllocSetAlloc(108)'. Even stranger are some messages that appear in the logfile, such as the following (edited for length, repetitions, etc): TopMemoryContext: 32792 total in 4 blocks; 9712 free (2 chunks); 23080 used TopTransactionContext: 8192 total in 1 blocks; 8176 free (0 chunks); 16 used DeferredTriggerXact: 0 total in 0...
0
1906
by: Mattia | last post by:
************************************************** Manage image without exhausted memory ************************************************** Hi; I have a big problem. I must create a script that upload an image an then resize it, if width or height are more than 250px. Now, after upload an image (in this example I suppose that it's a JPEG image):
3
6701
by: f.amann | last post by:
hi there! i save images in a mysql db and i wrote a script called getimage.php to display them. in my getimage.php i want to resize my images to display them as thumbnails but there always occurs the following error: <b>Fatal error</b>: Allowed memory size of 188743680 bytes exhausted (tried to allocate 240 bytes) in <b>.../public_html/getimage.php</b> on line <b>x</b><br />
3
1286
by: cmills28 | last post by:
Hi. I'm developing a php 4.3.10 script, extracting data from webpages. Using string functions (strpos, substr) alot, some arrays (both static & dynamic) also data is going to a MySQL 5 DB. Am using mysql_free_result() function to free memory, but I'm still having memory problems -- keep getting the memory exhausted error. I'm developing this on Windows XP, but the live site is on Linux. Would this problem be a glitch in my code, in...
1
2972
by: Kimmo Laine | last post by:
Hi! We've encountered a strange problem concerning memory usage. In the previous install the maximum memory amount per page was limited to 8 MB and it was never reached. Now, after upgrading both hardware and software, running the same scripts that used to be fine with 8 MB hit the roof all the time. The maximum memory allocation was set to 128 MB and still PHP encounters fatal errors with allowed memory size exhausted. Pardon my french,...
1
1666
by: David d'Angers | last post by:
hi group: i've been struggling with this simple problem with dismay i need all the file names in a directory since the number of files in a directory is unknown, a friend here in the group hinted me to use dynamic memory allocation: namely functions like malloc etc in the spirit of code re-use
2
4140
by: Sendil kumar | last post by:
Hi All, My application calls some java functionalities using C++. While running, my application crashes after 1 hour. The reason it saya is "Java: Heap memory exhausted", it couldn't allocate heap memory for further operations as it was exhausted. I think, java uses garbage collector to release memory when ever the objects goes out of scope. I even tried to catch the exception,but, It was not caught. Could any one give me solutions to catch...
5
24693
by: kumarmdb2 | last post by:
Hi guys, For last few days we are getting out of private memory error. We have a development environment. We tried to figure out the problem but we believe that it might be related to the OS (I am new to Windows so not sure). We are currently bouncing the instance to overcome this error. This generally happen at the end of business day only (So maybe memory might be getting used up?). We have already increased the statement heap & ...
3
3228
by: jitendrarathod | last post by:
Hello, I have a one PHP script which crawled the URLs and get the job from the URLs. My logic is so simple. First take the URL from database(total 25000 URLs). Then start to crawl the URLs. take the job and check in the database that job exist in database or not. If existed then update the visited date for that job. otherwise add new job record in database. Currently our database has 11422185 job records. And all are in one table. but...
0
8709
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8494
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8596
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.