skjaiswal1991 / 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

Can't render every first time #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. render an image for the first time
2.
3.

What is the expected output? What do you see instead?
expected the image. see nothing instead.

What version of the product are you using? On what operating system?
2.0b, windows vista, wamp (localhost)

Please provide any additional information below.
The first time i try to render any image SLIR return me nothing. From
second time with same image and same setting i see it.

Original issue reported on code.google.com by justme...@hotmail.com on 14 Apr 2010 at 6:31

GoogleCodeExporter commented 8 years ago
2.0b3

Original comment by justme...@hotmail.com on 14 Apr 2010 at 6:43

GoogleCodeExporter commented 8 years ago
Is there a solution for this problem?
I'm using the latest SVN version.

Original comment by thom...@wizz.be on 20 May 2010 at 7:18

GoogleCodeExporter commented 8 years ago
In your slir-config.php file, what is the value of SLIR_COPY_EXIF?

Also, is there any relevant information in your slir-error-log file or your PHP 
error 
log file?

Original comment by joe.lencioni on 20 May 2010 at 12:45

GoogleCodeExporter commented 8 years ago
This is my value:
define('SLIR_COPY_EXIF',            FALSE);

My error log doesn't seem to work! hmm Strange :) and it has 777 rights

I've asked my hosting company for the php error log.

Original comment by thom...@wizz.be on 20 May 2010 at 1:02

GoogleCodeExporter commented 8 years ago
FALSE me too

Original comment by justme...@hotmail.com on 20 May 2010 at 6:16

GoogleCodeExporter commented 8 years ago
@justmeo19@hotmail.com: Is there any relevant information in your 
slir-error-log file 
or your PHP error log file?

Original comment by joe.lencioni on 20 May 2010 at 6:20

GoogleCodeExporter commented 8 years ago
I've installed the error log correctly yesterday.

I also noticed a bigger problem. At night all the images are shown but when i 
get up
the images Can't render the first time. When i refresh it's no problem.

These errors i'm getting:
[Fri May 21 06:21:47 2010] [94.225.98.223 Mozilla/4.0 (compatible; MSIE 7.0; 
Windows
NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET 
CLR
3.0.30729; Media Center PC 6.0; InfoPath.1; OfficeLiveConnector.1.4;
OfficeLivePatch.1.3)] 2
file_put_contents(<PATH>/slir/cache/request/8b8f9083bcecb200800cf030283bffe5) 
[<a
href='function.file-put-contents'>function.file-put-contents</a>]: failed to 
open
stream: Permission denied

File: <PATH>/slir/slir.class.php
Line 874

Referrer: http://www.passiflora-meise.be/nl/passiflora2010

Request:
www.passiflora-meise.be/slir/w168-h233-c168:233-q100/covers/passiflora_affiche_A
2-20100412_Pagina_1_1.jpg
#0 [internal function]: SLIRException::error(2, 'file_put_conten...', 
'<PATH>p...',
874, Array)
#1 <PATH>/slir/slir.class.php(874): file_put_contents('<PATH>p...', 
'??????JFIF?????...')
#2 <PATH>a/slir/slir.class.php(852): SLIR->cacheFile('<PATH>p...',
'??????JFIF?????...', false, '<PATH>p...')
#3 <PATH>/slir/slir.class.php(1036): SLIR->cacheRequest('??????JFIF?????...', 
false)
#4 <PATH>/slir/slir.class.php(1001): SLIR->serveCachedImage('<PATH>p...', 
'rendered')
#5 <PATH>/slir/slir.class.php(202): SLIR->serveRenderedCachedImage()
#6 <PATH>/slir/index.php(37): SLIR->__construct()
#7 {main}

[Fri May 21 06:21:47 2010] [94.225.98.223 Mozilla/4.0 (compatible; MSIE 7.0; 
Windows
NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET 
CLR
3.0.30729; Media Center PC 6.0; InfoPath.1; OfficeLiveConnector.1.4;
OfficeLivePatch.1.3)] 2 Cannot modify header information - headers already sent

File: Unknown
Line 0

Referrer: http://www.passiflora-meise.be/nl/passiflora2010

Request:
www.passiflora-meise.be/slir/w168-h233-c168:233-q100/covers/passiflora_affiche_A
2-20100412_Pagina_1_1.jpg
#0 [internal function]: SLIRException::error(2, 'Cannot modify h...', 
'Unknown', 0,
Array)
#1 [internal function]: ob_gzhandler('??????JFIF?????...', 5)
#2 {main}

Original comment by thom...@wizz.be on 21 May 2010 at 7:01

GoogleCodeExporter commented 8 years ago
The first error, "failed to open stream: Permission denied," is telling you 
that the web server does 
not have permission to write to the cache file.

The second error, "Cannot modify header information - headers already sent," 
can probably be ignored 
at this time--I believe that is only happening because of the first error.

To fix the permission denied, make sure that the web server has permission to 
write to the cache 
directory (which, by default, should be located in your SLIR directory--you can 
change the location of 
this in your config file). On my server, I chmod the directory to 774 and chgrp 
the directory to be 
the group that the web server is running under (alternatively, you could chown 
it to the user the web 
server is running under). Can you fix the permissions on your cache directory 
and let me know if that 
resolves this for you?

Original comment by joe.lencioni on 21 May 2010 at 2:13

GoogleCodeExporter commented 8 years ago
I did the changes you asked and indeed the error over permission isn't shown 
anymore.

But i still get the following errors. And probably this is the real problem 
because
i've checked the link from the images-error and these images will not render the
first time. Second refresh everything works.

[Fri May 21 17:42:17 2010] [78.21.242.149 Mozilla/5.0 (Windows; U; Windows NT 
6.1;
nl; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3] 2 Cannot modify header 
information -
headers already sent

File: Unknown
Line 0

Referrer: http://passiflora-meise.be/fr/passiflora2010

Request: passiflora-meise.be/slir/w240-q100/articles/bos2%5B1%5D_66.jpeg
#0 [internal function]: SLIRException::error(2, 'Cannot modify h...', 
'Unknown', 0,
Array)
#1 [internal function]: ob_gzhandler('??????JFIF?????...', 5)
#2 {main}

[Fri May 21 17:42:17 2010] [78.21.242.149 Mozilla/5.0 (Windows; U; Windows NT 
6.1;
nl; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3] 2 Cannot modify header 
information -
headers already sent

File: Unknown
Line 0

Referrer: http://passiflora-meise.be/fr/passiflora2010

Request: passiflora-meise.be/slir/w240-q100/articles/Logo%20BFG-FBEP_68.JPG
#0 [internal function]: SLIRException::error(2, 'Cannot modify h...', 
'Unknown', 0,
Array)
#1 [internal function]: ob_gzhandler('??????JFIF?????...', 5)
#2 {main}

Can you help me with this problem?

I also want to thank you for your quick reactions thank you very much.

Original comment by thom...@wizz.be on 21 May 2010 at 5:53

GoogleCodeExporter commented 8 years ago
On line 1263 of slirimage.class.php, try changing this:

  ob_start();

to this:

  ob_start(NULL);

And see if that fixes this for you. It should be the first line in the 
getData() function: 
http://www.google.com/codesearch/p?hl=en#9XI6IFzGojM/trunk/slirimage.class.php&q
=ob_start%20package:http://smart-
lencioni-image-resizer%5C.googlecode%5C.com&sa=N&cd=1&ct=rc&l=1079

Original comment by joe.lencioni on 21 May 2010 at 6:03

GoogleCodeExporter commented 8 years ago
I changed it but it didn't help still this error

[Fri May 21 18:27:49 2010] [78.21.242.149 Mozilla/5.0 (Windows; U; Windows NT 
6.1;
nl; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3] 2 Cannot modify header 
information -
headers already sent

File: Unknown
Line 0

Referrer: http://passiflora-meise.be/nl/base

Request: passiflora-meise.be/slir/w240-q100/uploads/ADL10od1_099471(1).jpg
#0 [internal function]: SLIRException::error(2, 'Cannot modify h...', 
'Unknown', 0,
Array)
#1 [internal function]: ob_gzhandler('??????JFIF?????...', 5)
#2 {main}

Original comment by thom...@wizz.be on 21 May 2010 at 6:30

GoogleCodeExporter commented 8 years ago
It kind of looks like your PHP is configured to send output through 
ob_gzhandler() which is sending HTTP headers after they 
have already been sent to the browser. Do you have any php_value 
auto_prepend_file directives in your httpd.conf file or 
.htaccess file?

Also, in slir-config.php can you try changing this:

define('SLIR_ERROR_IMAGES',             TRUE);

to this:

define('SLIR_ERROR_IMAGES',             FALSE);

I'm hoping we'll be able to get a more useful message.

Thanks for helping me try to tack down this problem.

Original comment by joe.lencioni on 21 May 2010 at 7:05

GoogleCodeExporter commented 8 years ago
The value of 'SLIR_ERROR_IMAGES' was already set to false by me.

Yes there is a auto prepend file. The code of the file is: 
<?php
ob_start("ob_gzhandler");
?>

Original comment by thom...@wizz.be on 21 May 2010 at 7:14

GoogleCodeExporter commented 8 years ago
Bingo. In slir.class.php, add this in __construct() just after the 
error_reporting() 
call (line 176):

ob_end_clean();

Original comment by joe.lencioni on 21 May 2010 at 7:22

GoogleCodeExporter commented 8 years ago
Ok now i think i can follow you. I was experimenting and  if i comment the
ob_start("ob_gzhandler"); line it seems it is working fine :).

What is the best option i can do? Use your solution ore my solution? Or do you 
think
it doesn't matter?

I hope it wil still be working tomorrow morning that should make my week :).
Many thanks for your help. 

Original comment by thom...@wizz.be on 21 May 2010 at 8:40

GoogleCodeExporter commented 8 years ago
I am thinking that either way should make SLIR work. However, if you comment 
out the 
ob_start("ob_gzhandler"); line, that might remove some other functionality that 
you may 
want to keep.

I'd like to confirm that my solution works, and if it does, I will add it to 
the code 
so others in the future don't run into the same issue. Can you test my solution 
and let 
me know if it works for you?

Original comment by joe.lencioni on 21 May 2010 at 8:59

GoogleCodeExporter commented 8 years ago
ob_end_clean();

do nothing for me

Original comment by justme...@hotmail.com on 2 Jun 2010 at 8:59

GoogleCodeExporter commented 8 years ago
justmeo19@hotmail.com: can you try adding this to the top of __construct() in 
slir.class.php?

while (ob_get_level())
  ob_end_clean();

Original comment by joe.lencioni on 2 Jun 2010 at 9:04

GoogleCodeExporter commented 8 years ago
ok i tried

while (ob_get_level())
ob_end_clean();

still no render in local at first try

Original comment by justme...@hotmail.com on 3 Jun 2010 at 1:13

GoogleCodeExporter commented 8 years ago
justmeo19@hotmail.com: can you look in your slir-error-log file and your PHP 
error log 
and post any relevant information from in there?

Original comment by joe.lencioni on 3 Jun 2010 at 1:31

GoogleCodeExporter commented 8 years ago
I had the same issue on my dev enviroment (WAMP /Windows)

I was able to get it working by setting SLIR_USE_REQUEST_CACHE to FALSE

Original comment by fady%fro...@gtempaccount.com on 13 Aug 2010 at 6:01

GoogleCodeExporter commented 8 years ago
I've been having the same problem. Doesn't render on first load. I have 
followed this report and nothing worked until, as 
f...@frontieradvertising.com.au mentioned, I changed SLIR_USE_REQUEST_CACHE to 
FALSE in config file. Seems to work now on first load. What exactly does that 
function do? From the brief description I can't figure out what it does...

Original comment by Michael....@gmail.com on 13 Aug 2010 at 3:16

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I hope Joe is answering the last two approaches to the solution since I get the 
same issues but I don't believe the solution is to touch the 
SLIR_USE_REQUEST_CACHE since it takes care of "Write an image to the cache" on 
line 830 of slir.class.php

Original comment by disena...@gmail.com on 26 Aug 2010 at 5:02

GoogleCodeExporter commented 8 years ago
>  I changed SLIR_USE_REQUEST_CACHE to FALSE in config file. Seems to work now 
on first load. What exactly does that function do?

SLIR keeps two caches: a rendered cache and a request cache.

The rendered cache contains the rendered image files. This cache prevents SLIR 
from re-rendering images each time one is requested.

The request cache contains symlinks to the files in the rendered cache based on 
the request URI. This is because requests that have different URIs may end up 
producing the same rendered image. This speeds up SLIR's responses by bypassing 
all of the parameter checking and it is not strictly necessary.

The symlinks in the request cache are created using PHP's symlink() function 
(http://us3.php.net/symlink) which, on Windows, was not available until PHP 
5.3.0. Do you happen to be using an older version of PHP on a Windows server?

If so, and that is the problem, adding a check to see if the function exists 
before it is used may resolve this issue.

Original comment by joe.lencioni on 26 Aug 2010 at 5:19

GoogleCodeExporter commented 8 years ago
I'm running v5.3 on my localhost (WAMP / Windows) and I still have this error.
Will there be a fix to this problem?

Original comment by spsti...@hotmail.com on 1 Nov 2010 at 9:13

GoogleCodeExporter commented 8 years ago
Can you try changing in slir.class.php the line that reads:

if ($symlinkToPath && @symlink($symlinkToPath, $cacheFilePath))

to this: 

if ($symlinkToPath && function_exists('symlink') && symlink($symlinkToPath, 
$cacheFilePath))

Let me know if that fixes things for you or if you see any weirdness with that 
change. Here's a link to that part of the code 
http://code.google.com/p/smart-lencioni-image-resizer/source/browse/trunk/slir.c
lass.php?spec=svn109&r=108#959

Original comment by joe.lencioni on 12 Nov 2010 at 8:41

GoogleCodeExporter commented 8 years ago
Comment 27 by project member joe.lencioni, Nov 12, 2010

I can confirm that the fix in Comment 27 fix the issue for me on Windows 5.3.3

Original comment by randyI...@gmail.com on 20 Jan 2011 at 7:40

GoogleCodeExporter commented 8 years ago
Comment 27 work for me too, thanks!

Original comment by justme...@hotmail.com on 20 Jan 2011 at 8:26

GoogleCodeExporter commented 8 years ago
OK yes it was working fine with this fix in local, but now the bug happen on 
the server with the fix from comment 27

Original comment by justme...@hotmail.com on 21 Jan 2011 at 9:01