Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Image kao content-Type header ?

[es] :: PHP :: Image kao content-Type header ?

[ Pregleda: 2764 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

StratOS
Slovenija

Član broj: 2234
Poruke: 989
*.cable.triera.net.



+1 Profil

icon Image kao content-Type header ?14.09.2006. u 18:22 - pre 213 meseci
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
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."
 
Odgovor na temu

stefaneg
Stefan Rakonjac
Kragujevac

Član broj: 38922
Poruke: 130
89.216.231.*

ICQ: 279404274
Sajt: www.prvatehskola.org


Profil

icon Re: Image kao content-Type header ?14.09.2006. u 20:29 - pre 213 meseci
nešto najjednostavnije ti je

Code:

<?php

...

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

?>
 
Odgovor na temu

Schmidt
RHCE

Član broj: 80784
Poruke: 647
*.poen.net.



+10 Profil

icon Re: Image kao content-Type header ?14.09.2006. u 21:20 - pre 213 meseci
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

 
Odgovor na temu

StratOS
Slovenija

Član broj: 2234
Poruke: 989
*.cable.triera.net.



+1 Profil

icon Re: Image kao content-Type header ?15.09.2006. u 20:05 - pre 213 meseci
Hvala svima :)
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."
 
Odgovor na temu

[es] :: PHP :: Image kao content-Type header ?

[ Pregleda: 2764 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.