Autor Beitrag
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Sa 29.07.06 16:10 
Tach.

Ich hab in ner HTML zweimal folgenden Code:

ausblenden Quelltext
1:
<img src="random.php" alt="" style="margin: 0px 50px 0px 0px;" />					


Die "wichtige Stelle" in der random.php ist die folgende:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
srand ((double) microtime () * 1000000);
$filename = $list[rand (0, count ($list) - 1)];

header ('content-type: image/gif');
$im = ImageCreateFromGIF ($filename);
ImageGif ($im);
ImageDestroy ($im);


In $list stehen ca. 20 verschiedene Dateinamen zu verschiedenen Grafiken drin.

Das Problem: Ich bekomm bei beiden <img>s das selbe Bild angezeigt, obwohl ich doch per rand immer ein neues raussuche. Was mach ich falsch?!? :?

Danke schonmal. Bis dann.

mfG,
WeBBy

_________________
Steht der Bauer im Gemüse, hat er später grüne Füße.
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Sa 29.07.06 16:21 
user profile iconWeBsPaCe hat folgendes geschrieben:
Was mach ich falsch?!? :?
Wahrscheinlich merkt der Browser, daß beides mal der gleiche URI für das Bild verwendet wird, lädt es einmal und nimmt beim zweiten Anzeigen das bereits geladene.

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
WeBsPaCe Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: So 30.07.06 11:40 
Tach.

user profile icontommie-lie hat folgendes geschrieben:
Wahrscheinlich merkt der Browser, daß beides mal der gleiche URI für das Bild verwendet wird, lädt es einmal und nimmt beim zweiten Anzeigen das bereits geladene.


Willst du damit etwa sagen, dass ich gar nichts falsch mach? :mrgreen:

Egal. Ja, dachte ich mir auch (:mrgreen:), ich häng jetzt einfach an alle src="random.php" eine Zufallszahl dran indem ich per preg_replace mit Limit=1 ersetze.

Voll das Gewurschtel. ;) Danke. mfG,
WeBBy

_________________
Steht der Bauer im Gemüse, hat er später grüne Füße.
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: So 30.07.06 12:28 
user profile iconWeBsPaCe hat folgendes geschrieben:
Willst du damit etwa sagen, dass ich gar nichts falsch mach? :mrgreen:
Nicht direkt, nein.

WeBsPaCe hat folgendes geschrieben:
ich häng jetzt einfach an alle src="random.php" eine Zufallszahl dran indem ich per preg_replace mit Limit=1 ersetze.
Laut RFC muss jeder Cache-Mechanismus in der Request/Response Chain das HTTP-Cache-Control-Feld beachten. Ich weiß nicht, ob per Definition der lokale Browser-Cache ebenfalls dazu gehört, aber einen Versuch über Cache-Control wäre es ja mal wert. Probier's mal mit
ausblenden Quelltext
1:
2:
header("Cache-Control: no-cache"); /* no-store wäre die Haudrauf-Methode, falls no-cache nichts bringt */
header("Pragma: no-cache"); /* für alle HTTP/1.0-Caches, ich hoffe das benutzt niemand mehr, aber just in case... */
im Response-Header (also dort, wo du auch den Content-Type festlegst).
Vielleicht hilft's, wenn nicht, hilft wohl nur das, was du breits tust: unterschiedliche URIs erzwingen, indem irgendwelche blinden GET-Parameter angehangen werden.

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
WeBsPaCe Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: So 30.07.06 12:53 
Tach.

user profile icontommie-lie hat folgendes geschrieben:
Probier's mal mit
ausblenden Quelltext
1:
2:
header("Cache-Control: no-cache"); /* no-store wäre die Haudrauf-Methode, falls no-cache nichts bringt */
header("Pragma: no-cache"); /* für alle HTTP/1.0-Caches, ich hoffe das benutzt niemand mehr, aber just in case... */
im Response-Header (also dort, wo du auch den Content-Type festlegst).


Hilft bei mir beides nichts. Danke trotzdem, ist interessant... Lustig, muss mir das ganze Header-Zeugs mal anguckn.

Ich also doch nichts falsch gemacht? :mrgreen:

mfG,
WeBBy

_________________
Steht der Bauer im Gemüse, hat er später grüne Füße.
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: So 30.07.06 13:15 
user profile iconWeBsPaCe hat folgendes geschrieben:
Hilft bei mir beides nichts.
Schade, wenigstens no-store hätte funktionieren sollen. Anscheinend ignoriert der lokale Cache deines Browsers das Cache-Control. Welcher isses denn, oder geht's weder mit Firefox noch mit dem IE?

WeBsPaCe hat folgendes geschrieben:
Lustig, muss mir das ganze Header-Zeugs mal anguckn.
Es schadet nie, sich mit den Standards auseinander zu setzen, mit denen man arbeitet ;-)
HTTP/1.1 ist RFC 2616, bei der IETF glaube ich unter ietf.org/rfc/rfc2616.txt zu finden.

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
WeBsPaCe Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Do 03.08.06 15:25 
Tach.

Erstmal sorry, war die paar Tage weg, deshalb erst jetzt meine Antwort.

user profile icontommie-lie hat folgendes geschrieben:
Schade, wenigstens no-store hätte funktionieren sollen. Anscheinend ignoriert der lokale Cache deines Browsers das Cache-Control. Welcher isses denn, oder geht's weder mit Firefox noch mit dem IE?

Jap. Ich hab's ausprobiert mit Ff 1.5.0.4 (ja, ich weiß, ich muss noch updaten) und IE6.

user profile icontommie-lie hat folgendes geschrieben:
Es schadet nie, sich mit den Standards auseinander zu setzen, mit denen man arbeitet ;-)
HTTP/1.1 ist RFC 2616, bei der IETF glaube ich unter ietf.org/rfc/rfc2616.txt zu finden.

Stimmt schon, bloß wieso so'n ewigen Text durchlesen, wenn man's nie braucht. Jetzt brauch ich's, bzw. kann's vielleicht mal wieder gebrauchen, also les ich's mir durch. Hab ja Sommerferien. ;)

Danke nochmal. Schönen Sommer. :P mfG,
WeBBy

PS: Bin jetzt auch wieder eineinhalb Wochen weg.

_________________
Steht der Bauer im Gemüse, hat er später grüne Füße.