Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 3 odgovora
  • 3.796 pregleda

Najnovija ↓

Image kao content-Type header ? 14.09.2006. u 19:22 · pre 245 meseci #1
Pošto sam novi u php-imam pitanje :

Kako bi u php-u napisao skriptu za izbor random datoteke (*.jpg) na jednom diru !
Ali to ne HTML kodom, vec direkt preko headera

Content-Type: image/jpeg
Content-Length: xxxx

slika

Nešto kao ovo :

http://www.starsphere.net/login/botcheck.aspx


znam za header :
("Content-Type: image/jpeg");

kako da dobijem Content-Length i saljem raw data ?

Za random isto znam : echo rand(1,xx)

kako da spojim to skupa i da stvar radi

probao sam i sa imagejpeg()
i dobio
supplied argument is not a valid Image resource in /home/xxxxx/public_html/test.php

pomoč molim :)

hvala unaprijed
Potpis
Pozdrav StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"As a rule, software systems do not work well until they have been used, and have failed repeatedly, in real applications."
"The one who is digging the hole for the other to fall in is allready in it."
Re: Image kao content-Type header ? 14.09.2006. u 21:29 · pre 245 meseci #2
nešto najjednostavnije ti je

Code:

<?php

...

header('Content-Type: image/jpeg');
header('Content-Length: '.filesize($file));
readfile($file);

?>
Re: Image kao content-Type header ? 14.09.2006. u 22:20 · pre 245 meseci #3
Evo ti konkretan primjer

Content-type: image/pjpeg
Content-Disposition: inline; filename=_filename_
Content-Length: _velichina fajla u bajtima_
Cache-Control: public; max-age=604800
Expires: 604800

To ti sve ide u header, nakon toga odshtampaj samu sliku/raw

Re: Image kao content-Type header ? 15.09.2006. u 21:05 · pre 245 meseci #4
Hvala svima :)
Potpis
Pozdrav StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"As a rule, software systems do not work well until they have been used, and have failed repeatedly, in real applications."
"The one who is digging the hole for the other to fall in is allready in it."
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme