Re: Why doesn't this code work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for your support. It seems that I had to add the extension ".tiff"
to the image, since the image is of this type.

Now, the program returns "8", which seems to be the number that refers to
the type "tiff".

Thanks a lot for your kind support.

I was walking through an example that didn't insert the extension of the
image. Why should I include it here explicitly?

Thanks.

On Fri, Jan 30, 2015 at 3:20 PM, Maciek Sokolewicz <
maciek.sokolewicz@xxxxxxxxx> wrote:

> Most likely because "4.2.06" isn't an image...? Or an error occured.
> Try using var_dump($imagetype) instead to know for sure what you're
> recieving. If it's false, then either no signature is recognized, or it
> wasn't able to read the file (in which case you should also see an E_NOTICE
> in your error log).
> - Tul
>
> On 30 January 2015 at 23:58, Abdul Abdul <abdul.sw84@xxxxxxxxx> wrote:
>
>> Thanks all for your support.
>>
>> After fixing the issues you noticed, I get the first part of the "echo",
>> but, the image type is not displayed. Why is that?
>>
>> Sorry, I'm new to PHP, how can I turn on the error log?
>>
>> Thanks a lot for your kind support.
>>
>>
>>
>> On Fri, Jan 30, 2015 at 1:23 PM, Maciek Sokolewicz <
>> maciek.sokolewicz@xxxxxxxxx> wrote:
>>
>>> On 30-1-2015 19:04, Mark Montague wrote:
>>>
>>>> On 2015-01-30 11:39, Abdul Abdul wrote:
>>>>
>>>>> Thanks for your reply. I get a blank screen.
>>>>>
>>>>> On Fri, Jan 30, 2015 at 6:33 AM, Ashley Sheridan
>>>>> <ash@xxxxxxxxxxxxxxxxxxxx>
>>>>> wrote:
>>>>>
>>>>>  On 30 January 2015 14:26:51 GMT+00:00, Abdul Abdul
>>>>>> <abdul.sw84@xxxxxxxxx>
>>>>>> wrote:
>>>>>>
>>>>>>> I have the following PHP script, where I'm trying to retrieve the
>>>>>>> image
>>>>>>> type. Why doesn't it work? What am I doing wrong?
>>>>>>>
>>>>>>> <?php
>>>>>>> $image="4.2.06"
>>>>>>> $imagetype = exif_imagetype($image);
>>>>>>> echo "Image type is: " $imagetype;
>>>>>>> ?>
>>>>>>>
>>>>>> What does "doesn't work" mean? What output are you getting? Are there
>>>>>> any
>>>>>> errors or warnings in your logs?
>>>>>>
>>>>>
>>>> Ash's advice is correct:  check your error log.  However, I think that
>>>> one problem is that you don't have a semicolon at the end of the first
>>>> assignment statement above, which results in a syntax error occurring.
>>>>
>>>> Also, please do not top-post. Put your replies at the bottom instead.
>>>>
>>>>
>>> The problem is actually threefold;
>>> 1 - Errors aren't being displayed (display_errors in your php.ini is
>>> turned OFF; turn it on to see them), and YOU are not looking in the log for
>>> the errors (as suggested by Ashley and Mark).
>>> 2. You have a parse error online 2 as hinted by Mark: no semicolon to
>>> terminate the line. You don't see this error due to #1
>>> 3. You have another parse error on line 4 between the double quote and
>>> the variable you're trying to concatenate. You're missing the concatenation
>>> operator: the 'dot' (.). You don't see this error due to #1
>>>
>>> So, fix #1 either by turning on display_errors or read your logfiles.
>>> Then you'll be able to identify problems #2 and #3 for yourself, and fix
>>> them easily.
>>>
>>> - Tul
>>>
>>> ---
>>> This email has been checked for viruses by Avast antivirus software.
>>> http://www.avast.com
>>>
>>>
>>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux