Wednesday, August 15, 2012
show fix image with php
ကၽြန္ေတာ္တို႔ php နဲ႔ image ကို output ထုတ္ျပရေအာင္
တစ္ခ်ိဳကေတာ႔ ေျပာမွာေပါ႔ ဒီေလာက္လြယ္လြယ္ေလးကို ဟီး ဟုတ္ပါတယ္ ဒါေပမယ္႔ ေရးနည္းကိုလည္းၾကည္႔ပါဦးဗ်ာ လြယ္လားလို႔ ျပီးေတာ႔ မတူဘူးေလ
လြယ္လြယ္ေလးေျပာတဲ႔သူေတြရဲ႕ code က ဒီလိုေရးပါလိမ္႔မယ္
<?php
echo "<img src=\"image.jpg\">";
?>
ထြက္တာေပါ႔ image က ဒါေပမယ္႔ size ေတြက မတူညီၾကဘူးေလ ဒီလုိေတာ႔ အျခားနည္းနဲ႔ fix ျဖစ္ေအာင္ ပညာပါပါေရးၾကည္႔ရေအာင္
<?php
$image ="image.jpg";
header('Content-Type: image/jpg');
readfile($image);
?>
နည္းနည္းပဲ႔ကြာတာပါ ဟီး
တစ္ကယ္လို႔ Image ကို ေဒါင္းလုပ္လုပ္ခ်င္တယ္ဆိုရင္ေတာ႔
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename='.basename($image));
mediafire လိုမ်ိဳးေပါ႔
ဒါေလးနွစ္ခုထပ္ထည္႔ေပးလိုက္ေပါ႔
<?php
$image ="image.jpg";
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename='.basename($image));
header('Content-Type: image/jpg');
readfile($image);
?>
Thanks for Reading ..
Written by cyberoot1@gmail.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Thanks for your comments
Welcome from cyberoot