php.de

Zurück   php.de > Webentwicklung > PHP-Fortgeschrittene

PHP-Fortgeschrittene Arbeiten mit PHP ohne Einschränkungen

Antwort
 
LinkBack Themen-Optionen Thema bewerten
Alt 17.10.2005, 03:41  
Gast
 
Beiträge: n/a
Standard FATAL: emalloc(): Unable to allocate 14040 bytes

Nabend / Morgen!

Ich weis nicht mehr weiter. Es geht um ein Script das knapp 14 KB groesse Bildfragmente von ueber ein anderes Script abruft und mit imageCopyMerge() zusammenpackt.

Nach dem 28sten Fragment und knappen 15 sec verabschiedet sich der Mozilla mit "Das Dokument enthaelt keine Daten.". In den Appache Errorlogs finde ich dann besagte Fehlermeldung vor.

Maschine: Apache/1.3.29 (Win32) PHP/5.0.4
In der hppd.conf vom Appache ist nichts zu finden.
In der php.ini habe ich die entsprechenden Werte schon derbe erhoeht aber da tut sich nichts (tile-28,15-sec).

Code:
max_execution_time = 600;
max_input_time = 1200;
memory_limit = 256M;

Codeschnipsel

Code:
<?php
ob_end_flush();

$tiles = array_fill(1,60,'http://localhost/meinbild.php');
$tileWidthHeight = 250;

$dstImg =  imagecreatetruecolor (3500,2400);

foreach ($tiles as $tileID => $tileLocation) {

	$tile = imageCreateFromJPEG($tileLocation);  //editiert

	echo "writing tile $tileID\n";
	flush();

	imageCopyMerge($dstImg,$tile,$offsetX,$offsetY, 0, 0,$tileWidthHeight,$tileWidthHeight,100);
	imagedestroy($tile);
	
	$offsetX = $offsetX+$tileWidthHeight;
	$offsetY = $offsetY+$tileWidthHeight; //falsch: wird im Orginalscript vorher berechnet und steigt nach einer Zeile um $tileWidthHeight

}
?>
Das Bild bekomme ich hierher (hier liegt auch irgendwo das Problem). Gebe ich das Bild einfach ohne imageCopy() aus rennt die Kiste.

Code:
<?php

$srcOne ="grosses.jpg";   // knappe 3500 x 2400 px
$srcTwo = "test.png"; // 250 x 250 px

$result =  imagecreatetruecolor (250,250);
$imgOne = imageCreateFromJPEG ($srcOne);
$imgTwo = imageCreateFromPNG ($srcTwo);

imageSaveAlpha($imgTwo, true);
imageAlphaBlending($imgTwo, false);

imageCopy ($result,$imgOne,0,0,0,0,250,250);
imageCopy ($result,$imgTwo,0,0,0,0,250,250);

Header("Content-type: image/jpeg");
imageJPEG($result);

imagedestroy($result);
imagedestroy($imgOne);
imagedestroy($imgTwo);

?>
Beiss mir an dem Problem jetzt schon ne Ewigkeit die Zaehne aus, Hilfe ist mehr als willkommen.

GreetinX
Christian
  Mit Zitat antworten
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 17.10.2005, 11:37  
Gast
 
Beiträge: n/a
Standard

Zitat:
$dstImg = imagecreatetruecolor (3500,2400);
3500*2400=8400000
4 byte je pixel (rgba) -> 33600000 bytes ~ 32M
Passiert mit dstImg eigentlich irgendwas, ausser dass es in jedem Schleifendurchgang durch ein neues 32M imagecreatetruecolor überschrieben wird? Wie oft passiert das?
  Mit Zitat antworten
Alt 17.10.2005, 12:59  
Gast
 
Beiträge: n/a
Standard

Code:
$dstImg = imagecreatetruecolor (3500,2400);
ist ausversehen mit in die foreach gerutscht, der offset ist auch falsch, wird aber eingtlich vorher errechnet. (editiert s.o.)

Das alles tut dem ganzen aber kein Abbruch, ich schaffe es jetzt bis "tile 29", dann tritt besagtes Problem wieder auf.

Der Sinn von $dstImg ist es im Verlauf der Schleife komplett mit Bildfragmenten
Code:
$summeBildkacheln =  floor($bildBreite/$kachelBreite*floor($bildHoehe/$kachelHoehe);
gefuellt zu werden um diese anschliessend auszugeben.
  Mit Zitat antworten
Antwort


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
update auf php 5.0.4 robo47 Server, Hosting und Workstations 6 10.04.2005 19:00
Fatal error: Allowed memory size of 8192 bytes exhausted at PHP Tipps 2005 11 06.03.2005 19:26

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
emalloc, fatal: emalloc(): unable to allocate, emalloc(), emalloc(): unable to allocate, php emalloc, php allocate, memory unable to allocate 60 bytes, emalloc php, php emalloc(), emalloc unable to allocate, fatal emalloc, unable to allocate bytes, unable to alloc 2400 bytes, php _emalloc, unable to allocate, php \unable to allocate\, apache emalloc() unable to allocate xx bytes, fatal emalloc unable to allocate, emalloc unable to allocate php fehlermeldung, fatal: emalloc():

Alle Zeitangaben in WEZ +2. Es ist jetzt 20:47 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.