Forum Moderators: coopster

Message Too Old, No Replies

deliver content based on connection speed with php

any way to do this with PHP i.e. one image for 56k one for broadband

         

hughie

3:31 pm on Oct 11, 2004 (gmt 0)

10+ Year Member



Does anyone know a way of delivering content based on the connection speed automatically, preferably with PHP

I've come across one system but it's $300 and not PHP. I can't justify that without a client willing to foot the bill.

I've found PHPsniff but it doesn't seem to register connection speed (lots of other useful browser info though)

Cheers,
hughie

jatar_k

4:21 pm on Oct 12, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I don't know of one

I also don't completely see the point. Just serve light and tight images for everyone.

mincklerstraat

12:46 am on Oct 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if you're an incredible clothes horse like I am occasionally when it comes to graphics design (an image up to 20K!), make it a css background image and use explicit width and height - your page will load in with intact format without image, and then image comes in.

Code Sentinel

3:34 am on Oct 13, 2004 (gmt 0)

10+ Year Member



seems like a lot you would need to know about the connection.. and without actually sending a file and timing it then I'm not sure you can get an accurate speed.

what if the user is browsing through a proxy? the person may be on a 9600 baud modem but the proxy pulls it in at 100mb.

do like mincklerstraat suggests, it gives the illusion of speed.. make what the surfer is looking for appear first or make something appear right away. (a problem with nested tables or large tables with images that do not contain image sizes in the tag, etc)

hughie

9:07 am on Oct 13, 2004 (gmt 0)

10+ Year Member



I was thinking in terms of advertising material or similar.

For instance,
person with 56k connection gets basic advert (5k)
person with broadband gets advert with video (150k)

I've seen yahoo do it and i know of a way not using php but its $300 like i said. Not sure how they would get round the proxy problem though, thats a good point!

SofterLogic UK

11:30 am on Oct 13, 2004 (gmt 0)

10+ Year Member



...two buttons... "Broadband Version (High Speed)" "DialUp Version (Low Graphics)" ....

Failing that just check how long the first page takes to load. Store "loadtime/pagesize" in a cookie. For all future loads do 'if ($_COOKIE['speed']>123) {}'

hughie

11:36 am on Oct 13, 2004 (gmt 0)

10+ Year Member



The ' choose your speed' is the current option but i'd like to do it seamlessly, especially on the home page.

Have a look at <snip> all one of course. they do it with ASP/JSP and it seems very good, i'm looking for a php alternative thats cheaper.

Not tested it with a proxy though.

ta,
hughie

[edited by: jatar_k at 5:08 pm (utc) on Oct. 13, 2004]
[edit reason] removed url [/edit]

henry0

12:28 pm on Oct 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mincklerstraat,
I like your suggestion
but it brings up a question
how will you use it if an img is the result of a DB query (img path)
I do not think that you can pass a <? url...?> or a var or a query within a css doc; anyway never tried it :)

Regards
Henry

jetboy_70

12:55 pm on Oct 13, 2004 (gmt 0)

10+ Year Member



henry0,

You can put server-side code in a CSS file, so database queries shouldn't be a problem. However, it'd probably be better to do the query as normal and pass any appropriate paths to the CSS file when you call it:

<style type="text/css">
@import style.css?img1=pathtoimg1&img2=pathtoimg2";
</style>

henry0

1:49 pm on Oct 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



jetboy_70
Great; still learning :)
Thanks

Regards
Henry

mincklerstraat

3:36 pm on Oct 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I usually only have one big honking image I want in a background. In this case, I find it easier just to put <style>.honking{ background-image: url(bigmutha1.jpg);}</style>
inside the head tag than actually including the extra stylesheet. All the other background properties of .honking can be declared in the ordinary stylesheet, just make sure you use background-image and not the shorthand 'background: ' or that'll reset everything.

If you're going for a whole lot of fancy background gizmos (and why not!), including the sheet like jetboy recommends is best. However, there are certain things you'll want to know before you try. See third message in [webmasterworld.com...] regarding headers needed for css sheets in moz and on the non-cachability of php css sheets unless you deliver extra cache-info headers.