Re: Next question about data output...<smile>
"Jacob Kruger" <[email protected]>
| Newsgroups | gmane.comp.php.windows |
|---|---|
| Message-ID | <B31CEBAC59D047CC9AB0F04CF24BD7A2@JacobPC> |
For example, if now roll back to that older version of direct call to database, just using mysqli's sort of direct query, instead of using the mysqli_statement object, it does seem to try to render image, without generating direct errors, FWIW - bit slow - and, trying to explain to sort of site owner why he should use either smaller, or lower DPI images - but, seems to work as such - even on production server, FWIW. Stay well Jacob Kruger Blind Biker Skype: BlindZA '...fate had broken his body, but not his spirit...' ----- Original Message ----- From: "Sascha Meyer" <[email protected]> To: "Jacob Kruger" <[email protected]> Sent: Friday, August 16, 2013 1:39 PM Subject: Aw: Re: [PHP-WIN] Next question about data output...<smile> > Jacob, > > could you post the part of your code where the error occurs? Perhaps we > can optimize some of the code to reduce the amount of memory used by the > script. > > Cheers, > > Sascha > >> Gesendet: Freitag, 16. August 2013 um 12:15 Uhr >> Von: "Jacob Kruger" <[email protected]> >> An: "Sascha Meyer" <[email protected]> >> Cc: [email protected] >> Betreff: Re: [PHP-WIN] Next question about data output...<smile> >> >> OK, seems what's causing issue is imagecreatefromstring(), since, >> directly >> after retrieving longblob data from database, memory usage is: >> 3402136 = 3.*Mb >> >> and, then immediately after that calling: >> $imgOut = imagecreatefromstring($bOut); >> >> and, return that $imgOut variable to calling function, before do anything >> else, memory usage: >> 44063856 - 44Mb+ >> >> And, this is on my windows development machine, so seems issue is with >> operations, and not machine specific, although not sure why it's working >> on >> this machine, and not on production server. >> >> Either way, think will, for now, switch image output rendering back to >> simpler method that worked before, instead of using actual >> mysqli_statement, >> and see if works as such - might also put the memory usage 'logging' in >> there, to actually compare them, or something. >> >> Stay well >> >> Jacob Kruger >> Blind Biker >> Skype: BlindZA >> '...fate had broken his body, but not his spirit...' >> >> ----- Original Message ----- >> From: "Sascha Meyer" <[email protected]> >> To: "Jacob Kruger" <[email protected]> >> Sent: Friday, August 16, 2013 8:57 AM >> Subject: Aw: [PHP-WIN] Next question about data output...<smile> >> >> >> > Good morning Jacob, >> > >> > could you check if memory has been eaten up before the mysqli_statement >> > is >> > executed? memory_get_usage() [1] could help in that case. Are you using >> > different PHP versions on your local dev machine and on the production >> > server? >> > >> > Best regards, >> > >> > Sascha >> > >> > [1] http://php.net/manual/en/function.memory-get-usage.php >> > >> >> Gesendet: Freitag, 16. August 2013 um 08:42 Uhr >> >> Von: "Jacob Kruger" <[email protected]> >> >> An: [email protected] >> >> Betreff: [PHP-WIN] Next question about data output...<smile> >> >> >> >> On my development, windows machine, the memory_limit iniValue is set >> >> to >> >> 128M, and on the production server - think linux box, it's set to >> >> 1280M, >> >> but, the bit of script to render an image from database as image >> >> resource >> >> to browser, works fine on my machine, but, on server, the following >> >> error >> >> occurs: >> >> PHP Fatal error: Allowed memory size of 1342177280 bytes exhausted >> >> (tried >> >> to allocate 4294967296 >> >> >> >> According to server log, it seems to be happening on the line where >> >> the >> >> mysqli_statement tries to execute the query to retrieve a longblob >> >> value >> >> of 2.1Mb, but anyway. >> >> >> >> I am making sure try to destroy any image resources, etc., am closing >> >> statement object after executing it, etc. - and there aren't really >> >> any >> >> recursive loops being executed, but, just a page instantiating an >> >> instance of a wrapper class, which then refers to the >> >> imageManipulation >> >> object, to then pull the images data out of the DB - thoughts? >> >> >> >> TIA >> >> >> >> Jacob Kruger >> >> Blind Biker >> >> Skype: BlindZA >> >> '...fate had broken his body, but not his spirit...' >> >> >> > >> >> >> -- >> PHP Windows Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php