php-general Digest 16 Jun 2011 17:48:55 -0000 Issue 7361

Topics (messages 313555 through 313559):

Re: How to PHP get bit depth of a given PNG image file?
        313555 by: Mattias Thorslund
        313556 by: Nam Gi VU
        313557 by: Mattias Thorslund

Doctrine madness!
        313558 by: Nathan Nobbe

Re: Convert a PDF to a PNG?
        313559 by: Brian Dunning

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On 06/15/2011 10:11 PM, Nam Gi VU wrote:
  Hi everyone,

In PHP code, given an .png image path, I need to detect the bit-depth of
that image. How can I do that?

I've tried to use getImageSize() and read the bits as below sample code but
it always returns '8' for 24-bits/32-bits image.

Reading the manual, it says:

"
channels will be 3 for RGB pictures and 4 for CMYK pictures.
bits is the number of bits for each color.
"

So, to get the total bit depth, I think you need to multiply by the number of colors, which is in the "channels" element.

Cheers,

Mattias


--- End Message ---
--- Begin Message ---
Thank you Mattias,

I'll look at `channels` again.

Regards,
Nam



On Thu, Jun 16, 2011 at 1:06 PM, Mattias Thorslund <matt...@thorslund.us>wrote:

> On 06/15/2011 10:11 PM, Nam Gi VU wrote:
>
>>  Hi everyone,
>>
>> In PHP code, given an .png image path, I need to detect the bit-depth of
>> that image. How can I do that?
>>
>> I've tried to use getImageSize() and read the bits as below sample code
>> but
>> it always returns '8' for 24-bits/32-bits image.
>>
>
> Reading the manual, it says:
>
> "
> channels will be 3 for RGB pictures and 4 for CMYK pictures.
> bits is the number of bits for each color.
> "
>
> So, to get the total bit depth, I think you need to multiply by the number
> of colors, which is in the "channels" element.
>
> Cheers,
>
> Mattias
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message --- I think the documentation is a bit unclear about the fact that "colors" and "channels" are the same thing here. The line about bits should probably say "bits is the number of bits for each *channel*".

Mattias

On 06/15/2011 11:11 PM, Nam Gi VU wrote:
Thank you Mattias,

I'll look at `channels` again.

Regards,
Nam



On Thu, Jun 16, 2011 at 1:06 PM, Mattias Thorslund<matt...@thorslund.us>wrote:

On 06/15/2011 10:11 PM, Nam Gi VU wrote:

  Hi everyone,

In PHP code, given an .png image path, I need to detect the bit-depth of
that image. How can I do that?

I've tried to use getImageSize() and read the bits as below sample code
but
it always returns '8' for 24-bits/32-bits image.

Reading the manual, it says:

"
channels will be 3 for RGB pictures and 4 for CMYK pictures.
bits is the number of bits for each color.
"

So, to get the total bit depth, I think you need to multiply by the number
of colors, which is in the "channels" element.

Cheers,

Mattias


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--- End Message ---
--- Begin Message ---
Hi gang,

If anyone out there has some experience w/ Doctrine now would be a great
time to share it!

So I'm writing a batch importer and noticed memory usage climbing during
script execution.

In the debugging effort I've isolated it down to a Doctrine issue.

Here's what's going on, I instantiate a model object for the product table
from my application

$newRecord = new Product();

at this point memory usage goes up noticeably.  I don't really care though
because I figure I can delete it, but look at this madness I have going
(which *fails* to free up the memory)

$newRecord->clearRelated();
$newRecord->free();
unset($newRecord);
gc_collect_cycles();

after all of this memory consumption is still dramatically higher than prior
to the first call creating the object above.  This I've verified through
memory_get_usage().

here's the output from the memory_get_usage() calls

int(166461440) // before new Product()
int(169345024) // directly after new Product()
int(169345024) // after madness trying to free memory used by new Product()

I've also tried an explicit call to the destructor of $newRecord, but that
results in a fatal attempting to call an unknown method.

Any help would be greatly appreciated as google hasn't been able to point me
to the answer thus far.

thx,

-nathan

--- End Message ---
--- Begin Message ---
I have heard back from Rackspace and ImageMagick is not going to happen for the 
time being, but they say Ghostscript is installed. Is it possible to do this 
completely with GS without ImageMagick? The PDFs are text only.


On Jun 15, 2011, at 2:28 AM, Richard Quadling wrote:

> I use PDF2PNG as this provides the cleanest output mechanism I've
> found. But I didn't try GS which, theoretically, should be perfect.

--- End Message ---

Reply via email to