keshav123 / smart-lencioni-image-resizer

Automatically exported from code.google.com/p/smart-lencioni-image-resizer
GNU General Public License v3.0
0 stars 0 forks source link

error message #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
got some error when a new image is generated (see attached log),
after a browser reload it works fine though, also further cached output
works fine, the error comes only the first time.
I'm using the download version and the latest files in the source.

otherwise, great script so far!
I used phpthumb before but it proved to be very unreliable with MIME type
output of cached images, which was bad for javascript/IE.

Original issue reported on code.google.com by angstr...@gmail.com on 21 Sep 2009 at 9:19

Attachments:

GoogleCodeExporter commented 9 years ago
I just wanted to say that I am having the same problem. Once I do a 
shift-reload in
FF it creates the thumbnails and everything is fine after that.

Original comment by adrianbj...@gmail.com on 8 Oct 2009 at 5:40

GoogleCodeExporter commented 9 years ago
Have the same problem. I didn't have any problems for weeks. 

I now changed SLIR_COPY_EXIF to false, this seems to solve the problem.

Original comment by tomn...@gmail.com on 1 Nov 2009 at 1:06

GoogleCodeExporter commented 9 years ago
It looks like this is an outstanding issue in PEL, which is a PHP Exif Library 
that SLIR 
uses to preserve Exif data in its resized images. 
http://sourceforge.net/tracker/?
func=detail&atid=650322&aid=1786345&group_id=108380

I believe it is related to having PHP error reporting set to report strict 
warnings on your 
server. http://us.php.net/manual/en/errorfunc.constants.php

Try putting this code at the top of the __construct() method of slir.class.php:

    error_reporting(0);

Hopefully that should fix it. Please let me know either way.

Original comment by joe.lencioni on 25 Jan 2010 at 7:43

GoogleCodeExporter commented 9 years ago
My php.ini reads:
error_reporting = E_ALL & ~E_NOTICE

I have added error_reporting(0); but now all that seems to happen is that the 
image
is not available at all until I reload the page. Perhaps I should also clarify 
that
before, the image that was being loaded showed the error message. Perhaps this 
is a
different issue to angstraum.

Thanks,
Adrian

Original comment by adrianbj...@gmail.com on 25 Jan 2010 at 8:06

GoogleCodeExporter commented 9 years ago
@adrianbjones: I am unable to reproduce this problem on my servers.

* Will you post an image that you are having this issue with?
* What version of PHP are you running?
* Can you try changing your php.ini to read:
    error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT

Original comment by joe.lencioni on 25 Jan 2010 at 8:16

GoogleCodeExporter commented 9 years ago
OK, I made the change to php.ini - made no difference.

I have attached the original image, the image that is displayed the first time 
(error
message image) and the image that is displayed when it finally works (after a 
page
reload).

Also, thought it might help to know that I am running PHP 5.2.12 on linux

Thanks

Original comment by adrianbj...@gmail.com on 25 Jan 2010 at 8:34

Attachments:

GoogleCodeExporter commented 9 years ago
Using your image, I can reproduce the error by adding 
error_reporting(E_STRICT); to the 
top of the __construct() method in slir.class.php running PHP 5.1.6 on linux.

Can you try checking out the latest from SVN and let me know if that fixes it? 
Try 
restarting your server after you have the new code in case there is some sort 
of 
caching mechanism enabled.

Original comment by joe.lencioni on 25 Jan 2010 at 9:44

GoogleCodeExporter commented 9 years ago
Ok, I got the latest SVN and made sure the server was restarted. Unfortunately 
still
the same issue. Wish I could think of some more info to give you.

Original comment by adrianbj...@gmail.com on 25 Jan 2010 at 10:25

GoogleCodeExporter commented 9 years ago
Even tried r58 just then - still no luck for me - sorry!

Original comment by adrianbj...@gmail.com on 25 Jan 2010 at 10:30

GoogleCodeExporter commented 9 years ago
Here is the full entry my php error log:

PHP Fatal error:  Uncaught exception 'SLIRException' with message '2048 
Declaration
of PelEntryUserComment::setValue() should be compatible with that of
PelEntryUndefined::setValue()

File: /xxx/xxx/slir/pel-0.9.1/PelEntryUndefined.php
Line 285' in /xxx/xxx/slir/slirexception.class.php:256
Stack trace:
#0 /xxx/xxx/slir/pel-0.9.1/PelIfd.php(39): SLIRException::error(2048, 
'Declaration of
...', '/xxx/xxx/imag...', 285, Array)
#1 /xxx/xxx/slir/pel-0.9.1/PelIfd.php(39): require_once()
#2 /xxx/xxx/slir/pel-0.9.1/PelTag.php(40): require_once('/xxx/xxx/imag...')
#3 /xxx/xxx/slir/pel-0.9.1/PelEntry.php(47): require_once('/xxx/xxx/imag...')
#4 /xxx/xxx/slir/pel-0.9.1/PelExif.php(42): require_once('/xxx/xxx/imag...')
#5 /xxx/xxx/slir/pel-0.9.1/PelJpeg.php(43): require_once('/xxx/xxx/imag...')
#6 /xxx/xxx/slir/slir.class.php(853): require_once('/xxx/xxx/imag...')
#7 /xxx/xxx/slir/slir.class.php(838): SLIR->copyEXIF('/xxx/xxx/ in
/xxx/xxx/slir/slirexception.class.php on line 256

Original comment by adrianbj...@gmail.com on 26 Jan 2010 at 2:11

GoogleCodeExporter commented 9 years ago
Thanks for all of your help trying to track this bug down. I think I just 
committed a 
change that resolves this. Can you give it another go with the latest SVN and 
let me 
know if that resolves the issue for you?

Original comment by joe.lencioni on 26 Jan 2010 at 2:31

GoogleCodeExporter commented 9 years ago
Well it prevents the display of the image that details the error, but it still
doesn't create the actual thumbnail I am trying to display. Error log is 
different
now though. All I am getting is:

PHP Fatal error:  Call to undefined function unixtojd() in
/xxx/xxx/slir/pel-0.9.1/PelEntryAscii.php on line 313

Weird given that it is a PHP function, although according to one of the 
comments on
this page, PHP needs to be compiled with "--enable-calendar". I am happy to do 
this
to see if it works, but I am surprised the PEL requires something not quite 
standard. 

Any thoughts on this before I recompile?

Original comment by adrianbj...@gmail.com on 26 Jan 2010 at 3:37

GoogleCodeExporter commented 9 years ago
I just checked out the PHP documentation page for unixtojd() and it doesn't 
mention 
anything about it being nonstandard or needing "--enable-calendar", so that's 
kinda 
weird.

In any case, you could try adding this code somewhere (maybe at the bottom of 
slir.class.php) based on the comment at 
http://www.php.net/manual/en/function.unixtojd.php#69310

if (!function_exists('unixtojd'))
{
  function unixtojd($timestamp)
  {
    return $timestamp / 86400 + 2440587.5;
  }
}

Note: I didn't test this, so it may not work as expected, but you get the idea.

Original comment by joe.lencioni on 26 Jan 2010 at 3:48

GoogleCodeExporter commented 9 years ago
I just made this change:
//$this->day_count = unixtojd($timestamp);
$this->day_count = $timestamp / 86400 + 2440587.5;

but now there is another error relating to jdtogregorian() on Line 270.

I found this function which should reproduce jdtogregorian():

  function unix_to_greg($unix_timestamp) {
    $julian = floor(((($unix_timestamp / "60") / "60") / "24") + "2440588");
    $julian = $julian - 1721119;
    $calc1 = 4 * $julian - 1;
    $year = floor($calc1 / 146097);
    $julian = floor($calc1 - 146097 * $year);
    $day = floor($julian / 4);
    $calc2 = 4 * $day + 3;
    $julian = floor($calc2 / 1461);
    $day = $calc2 - 1461 * $julian;
    $day = floor(($day + 4) / 4);
    $calc3 = 5 * $day - 3;
    $month = floor($calc3 / 153);
    $day = $calc3 - 153 * $month;
    $day = floor(($day + 5) / 5);
    $year = 100 * $year + $julian;

    if ($month < 10)
    {
        $month = $month + 3;
    }else{
        $month = $month - 9;
        $year = $year + 1;
    }
    return "$day.$month.$year";
}  

But for some reason when I call it, the error is coming back that says I haven't
defined this new function, even though I placed it at the top of the file - 
weird.

Maybe I might just have to recompile afterall.

Original comment by adrianbj...@gmail.com on 26 Jan 2010 at 3:53

GoogleCodeExporter commented 9 years ago
change "function unix_to_greg($unix_timestamp) {" to "function 
jdtogregorian($unix_timestamp) {"

Original comment by joe.lencioni on 26 Jan 2010 at 3:55

GoogleCodeExporter commented 9 years ago
Looks like we were both commenting at the same time and reading the same 
comment in
the PHP manual - as you can see, I basically tried the solution you suggested 
and
then tried to deal with the next error.

Note on this page:
http://www.w3schools.com/php/php_ref_calendar.asp

"However, if you are running the Linux version of PHP, you will have to compile 
PHP
with --enable-calendar to get the calendar functions to work."

Original comment by adrianbj...@gmail.com on 26 Jan 2010 at 3:57

GoogleCodeExporter commented 9 years ago
Yeah, it might actually be best to just recompile with --enable-calendar. I bet 
that 
would fix this problem for you.

Original comment by joe.lencioni on 26 Jan 2010 at 4:00

GoogleCodeExporter commented 9 years ago
Sorry for the delay - got sidetracked.

Yep, --enable-calendar seems to have fixed everything!

I think it would definitely be worth adding a note about that in the 
documentation
since it isn't a standard option on Linux PHP.

Thanks for all your help narrowing this down and sorry it was a fault with my 
server
and not your script.

Original comment by adrianbj...@gmail.com on 26 Jan 2010 at 4:45

GoogleCodeExporter commented 9 years ago
Fantastic! I'm glad everything is now working for you.

Original comment by joe.lencioni on 26 Jan 2010 at 1:26