Hi, i have this controller class to serve static files. It works well for the stylesheet file under a /static directory, locating it, but the images referenced in the stylesheet do not appear. They are in the same /static folder, next to the stylesheet.css file. link :rel => ''stylesheet'', :href => R(Static, ''stylesheet.css''), :type => ''text/css'' In the CSS file i try: background: #333333 url(img01.gif) repeat-x; The class is here: http://pastebin.com/f7c92f95a Another problem is for images, i cant seem to make them appear in the page using: img :src => R(Static, ''img04.jpg''), :alt => ''test image'' I always get the alternate description (or a thumb is no :alt is supplied). Any hint ? Thank you. -- pedro mg
On Nov 17, 2007 8:10 PM, pedro mg <seti at tquadrado.com> wrote:> > background: #333333 url(img01.gif) repeat-x; >url(/static/img01.gif) ? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20071117/148af3a9/attachment.html
On Sat, 2007-11-17 at 21:43 -0800, John Beppu wrote:> On Nov 17, 2007 8:10 PM, pedro mg <seti at tquadrado.com> wrote: > > background: #333333 url(img01.gif) repeat-x; > > url(/static/img01.gif)oh, sorry for the 2nd post. Ty John, but i tried that, and even the whole path to the images, and still no results. -- pedro mg
Can you access the image at (localhost:3301)/static/img01.gif through your browser? On 11/18/07, pedro mg <seti at tquadrado.com> wrote:> > On Sat, 2007-11-17 at 21:43 -0800, John Beppu wrote: > > On Nov 17, 2007 8:10 PM, pedro mg <seti at tquadrado.com> wrote: > > > > background: #333333 url(img01.gif) repeat-x; > > > > url(/static/img01.gif) > > oh, sorry for the 2nd post. > Ty John, but i tried that, and even the whole path to the images, and > still no results. > > -- > pedro mg > > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Magnus Holm -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20071118/7edb71d7/attachment.html
On Sun, 2007-11-18 at 18:23 +0100, Magnus Holm wrote:> Can you access the image at (localhost:3301)/static/img01.gif through > your browser?I get an error message: Couldn''t load image ''img01.gif'' Unrecognized image file format Same result for .jpg and .png image files. I guess i''m having problems with DOCTYPE and headers... -- pedro mg
On 19/11/2007, at 1:33 PM, pedro mg wrote:> On Sun, 2007-11-18 at 18:23 +0100, Magnus Holm wrote: >> Can you access the image at (localhost:3301)/static/img01.gif through >> your browser? > > I get an error message: > > Couldn''t load image ''img01.gif'' > Unrecognized image file formatWhen you get that, do a File->Save and see whether the file you save is identical to the source file. You aren''t running on Windows are you? The newline handling might be corrupting your files... Clifford Heath.
2007/11/18, pedro mg <seti at tquadrado.com>:> The class is here: http://pastebin.com/f7c92f95aRemove the quotes around the regexp on line 5. Right now the expression returns nil, which is not an entry in your MIME_TYPES hash. Apparently the browser can work around a nil mime-type for the .css but not for the pics. -- Cheers, zimbatm
On Mon, Nov 19, 2007 at 03:13:11PM +0100, Jonas Pfenniger wrote:> 2007/11/18, pedro mg <seti at tquadrado.com>: > > The class is here: http://pastebin.com/f7c92f95a > > Remove the quotes around the regexp on line 5. Right now the > expression returns nil, which is not an entry in your MIME_TYPES hash. > Apparently the browser can work around a nil mime-type for the .css > but not for the pics.Yes Jonas, thanks, i noticed it almost immediately through IRB testing ;) and did remove them: MIME_TYPES[file[(/\.\w+$/)]] || ''text/plain'' best regards, -- pedro mg
On Mon, Nov 19, 2007 at 02:10:06PM +1100, Clifford Heath wrote:> When you get that, do a File->Save and see whether the file you save is > identical to the source file.no, diff size corrupted image file. 2 more bytes added... \nl ?> You aren''t running on Windows are you? The newline handling might > be corrupting your files...no, Debian Etch. Epiphany and Iceweasel, same results. best regards, -- pedro mg http://blog.tquadrado.com
On Tue, Nov 20, 2007 at 06:34:12AM +0000, pedro mg wrote:> > You aren''t running on Windows are you? The newline handling might > > be corrupting your files...If i test http://localhost:3301/project/static/img01.png I get the correct Content-Type in the browser title: img01.png (PNG Image) If it is a gif file, i get (GIF Image), etc. But it doesnt render in the browser, reporting: The image "http://localhost:3301/project/static/img01.png" cannot be displayed because it contains errors. Any hint ? -- pedro mg
2007/11/20, pedro mg <seti at tquadrado.com>:> But it doesnt render in the browser, reporting: > The image "http://localhost:3301/project/static/img01.png" cannot be displayed because it contains errors. > > Any hint ?Are you still running the same code ? I''ve spotted another error : more line 5 between 6 and 7. Otherwise, your 403 error won''t have the right content-type. This is not the cause of your problem but it could help. Also, on what server are you running the code ? Mongrel ? And which version of camping are you using ? -- Cheers, zimbatm
Try this version : http://pastebin.com/m10c8fab0 -- Cheers, zimbatm
On Sun, Nov 18, 2007 at 04:10:04AM +0000, pedro mg wrote:> img :src => R(Static, ''img04.jpg''), :alt => ''test image''Hi, anyone using Lighttpd + FastCGI to run Camping using Why''s configuration shown at 4) in: http://code.whytheluckystiff.net/camping/wiki/TheCampingServerForLighttpd Focusing on the fastcgi module configuration we have: fastcgi.server = ( "" => ( ... ) With this, camping mounts all apps at ROOT. The problem is the image file handling. It handles ".css" and ".js" files correctly, but no image is handled. Mounting the app in a subdirectory: fastcgi.server = ( "/project1" => ( ... ) starts serving image files correctly for all other apps except for this one, since fastcgi will handle /project images (with error) In Debian, mime types are assigned to lighty via PERL script called from lighttpd.conf, so no need for assignement at the 10-fastcgi.conf file. So my question is: anyone using Lighttpd + FastCGI + Camping ? How do you serve images ? System: Debian 4.0 Camping 1.5 best regards, -- pedro mg
I know what I will say won''t help you : FastCGI is a total waste of time. Apart if you''re stucked with that setup, a reverse proxy of any kind does just fine and is much less hassle to maintain/operate. Contrary to FastCGI, HTTP is a well understood and supported protocol, with lots of different tools. I always use Nginx or Apache + Mongrels and it works fine. -- Cheers, zimbatm
Finally, a solution. After spending days on this, i got to a solution: use a Lighty specific header. Instead of: @headers[''X-Sendfile''] = full_path Use: @headers[''X-LIGHTTPD-Send-file''] = full_path There is still the need of the: fastcgi.server = ( "..." => (( ..., "allow-x-send-file" => "enable" ))) http://trac.lighttpd.net/trac/changeset/1097/branches/lighttpd-merge-1.4.x/doc/fastcgi.txt Wget logs the headers correctly: $ wget -d -S http://machine:port/webapp -o log $ wget -d -S http://machine:port/webapp/static/img001.jpg -o log TY zimbatm for the refactor. http://pastebin.com/mdd73c8b -- pedro mg