เอา ไฟล์ jpg มาทําเป็นไฟล์เวบได้ไหมครับ

เริ่มโดย tenzamak, 05 กันยายน 2009, 23:14:01

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

tenzamak

คือตอนนี้จําเป็นต้อง ทําเวบนึง ซึ่งมีรูปราวๆ 1000รูป ก็คือไม่มีไรมากครับ
แค่ใส่รูปในไฟล์ html มี 1000 รูป ก็สร้าง ไฟล์ html 1000ไฟล์ โดยที่ให้เอารูปนะ
เข้าไปอยู่ในหน้า html โดยที่หน้า html ไม่ต้องมีอะไรเลยครับ แค่แค่รุปเดียวโดดๆ

เข้าใจไหมครับ

ก็คือ เจน ไฟล์รูป ให้เป็นไฟล์เวบ แค่นั้นเอง ถ้าไม่มีต้องอาศัยลูกทุ่งแหละ
[direct=https://www.asiagb.com/hosting/]host[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/host-inter/]host inter[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/host-singapore/]hosting singapore[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/vps-2/]vps[/direct]ราคาเริ่มต้นที่ 500/เดือน

g-ji


tenzamak

ป่าวครับพี่จี้ มีงานนิดหน่อย และด้วยความขี้เกียจ คืออยากให้มันสร้างให้เลย
ผมจะตกแต่งทีหลังเอาเอง เพราะลอง ทําทีละไฟล์ ผ่านไป 20 ไฟล์ ลบแทบจับ
[direct=https://www.asiagb.com/hosting/]host[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/host-inter/]host inter[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/host-singapore/]hosting singapore[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/vps-2/]vps[/direct]ราคาเริ่มต้นที่ 500/เดือน

liveadsense

ชื่อรูป ออกมาแนวไหนครับ ถ้าเรียงเป็น ตัวเลข ละง่ายเลย

เตือนตัวเอง ว่าเก่งได้ แต่อย่ากร่าง
รู้รับฟัง ไม่ใช่พล่ามเป็นน้ำไหล
อย่าหลงตน ให้คนอื่นเหนื่อยหน่ายใจ
เจอบันได ถ้าขึ้นได้ ต้องลงเป็น

tenzamak

อ้างถึงจาก: liveadsense ใน 05 กันยายน 2009, 23:32:01
ชื่อรูป ออกมาแนวไหนครับ ถ้าเรียงเป็น ตัวเลข ละง่ายเลย

คือเป็นตัวหนังสือครับ แต่ว่าไฟล์ทุกไฟล์จะมี เลขเรียงเช่น 01ตามด้วยชื่อ  02ตามด้วยชื่อ

[direct=https://www.asiagb.com/hosting/]host[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/host-inter/]host inter[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/host-singapore/]hosting singapore[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/vps-2/]vps[/direct]ราคาเริ่มต้นที่ 500/เดือน

g-ji

เอาสคริปท์อ่านการ์ตูนไปโมเล่นจิ หุหุ

เอาป่าวเดี๋ยวส่งให้  :D (สคริปท์มันไม่มีอะไร แค่ สร้าง folder > folder > ไฟล์รูป)

เสร็จ

อ่ะ... ลองไปรื้อๆ โค้ดดู เจอ image_viewer ลองเอาไปใช้มั้ยนิ ไม่ต้องทำอะไรเลย

อัพไฟล์ไว้ใน DIR เดียวกับรูป เดี๋ยวมันสร้าง โค้ดให้เอง

tenzamak

อ้างถึงจาก: g-ji ใน 05 กันยายน 2009, 23:35:06
เอาสคริปท์อ่านการ์ตูนไปโมเล่นจิ หุหุ

เอาป่าวเดี๋ยวส่งให้  :D (สคริปท์มันไม่มีอะไร แค่ สร้าง folder > folder > ไฟล์รูป)

เสร็จ

อ่ะ... ลองไปรื้อๆ โค้ดดู เจอ image_viewer ลองเอาไปใช้มั้ยนิ ไม่ต้องทำอะไรเลย

อัพไฟล์ไว้ใน DIR เดียวกับรูป เดี๋ยวมันสร้าง โค้ดให้เอง
ขอบคุณครับ พี่ เอาครับจัดให้ทาง pm เน้อ

แต่จริงๆงานที่ได้รับมอบหมาย ต้อง html เท่านั้นอ่า
ก็คือว่า ใช้ php เจน ก็ได้ แต่เวลาส่งงาน ต้องส่งเฉพาะไฟล์ html  เท่านั้น
แต่ว่าสคิปที่พี่จี้ว่า อยากได้เป็นการส่วนตัว
[direct=https://www.asiagb.com/hosting/]host[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/host-inter/]host inter[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/host-singapore/]hosting singapore[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/vps-2/]vps[/direct]ราคาเริ่มต้นที่ 500/เดือน

g-ji


navico

เขียนโปรแกรมอ่านชื่อไฟล์รูปมาทีละรูป แล้วเอาไปสร้าง html น่าจะไม่ยากนะครับ... ผมว่า

navico

<?php
$dirin
="images";
$dir = @ opendir($dirin);

while ((
$file readdir($dir)) !== false)
  {
  $path=$dirin."/".$file;
  if(is_file($path))
  {
  echo "filename: " $file "<br />";
  $files=explode(".",$file);
  $newpath="html/".$files[0].".html";
  $code="<html>\n<head>\n</head>\n<body>\n<img src='../$dirin/$file'></body>\n</html>\n";
  $fileout=fopen($newpath,"w+");
  fwrite($fileout,$code);
  fclose($fileout);
  }
  }
closedir($dir);
?>

ลองดูครับ อาจจะดูไม่โปร แบบว่าๆ ยังอ่อนอ่ะครับ....

itdevil

หนัก BW ตายเลย เฮ้ย .jpg น้อยนิสมะเป็นไรนิ
เสร็จแล้วบอก จะไปอ่าน

tenzamak

อ้างถึงจาก: navico ใน 06 กันยายน 2009, 00:34:07
<?php
$dirin
="images";
$dir = @ opendir($dirin);

while ((
$file readdir($dir)) !== false)
  {
  $path=$dirin."/".$file;
  if(is_file($path))
  {
  echo "filename: " $file "<br />";
  $files=explode(".",$file);
  $newpath="html/".$files[0].".html";
  $code="<html>\n<head>\n</head>\n<body>\n<img src='../$dirin/$file'></body>\n</html>\n";
  $fileout=fopen($newpath,"w+");
  fwrite($fileout,$code);
  fclose($fileout);
  }
  }
closedir($dir);
?>

ลองดูครับ อาจจะดูไม่โปร แบบว่าๆ ยังอ่อนอ่ะครับ....

filename: 01.jpg

Warning: fopen(html/01 หน้าปก.html) [function.fopen]: failed to open stream: No such file or directory in E:\AppServ\www\index.php on line 14

Warning: fwrite(): supplied argument is not a valid stream resource in E:\AppServ\www\index.php on line 15

Warning: fclose(): supplied argument is not a valid stream resource in E:\AppServ\www\index.php on line 16
filename: .jpg

Warning: fopen(html/.html) [function.fopen]: failed to open stream: No such file or directory in E:\AppServ\www\index.php on line 14
[direct=https://www.asiagb.com/hosting/]host[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/host-inter/]host inter[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/host-singapore/]hosting singapore[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/vps-2/]vps[/direct]ราคาเริ่มต้นที่ 500/เดือน

g-ji

อ้างถึงจาก: tenzamak ใน 06 กันยายน 2009, 00:41:46
อ้างถึงจาก: navico ใน 06 กันยายน 2009, 00:34:07
<?php
$dirin
="images";
$dir = @ opendir($dirin);

while ((
$file readdir($dir)) !== false)
  {
  $path=$dirin."/".$file;
  if(is_file($path))
  {
  echo "filename: " $file "<br />";
  $files=explode(".",$file);
  $newpath="html/".$files[0].".html";
  $code="<html>\n<head>\n</head>\n<body>\n<img src='../$dirin/$file'></body>\n</html>\n";
  $fileout=fopen($newpath,"w+");
  fwrite($fileout,$code);
  fclose($fileout);
  }
  }
closedir($dir);
?>

ลองดูครับ อาจจะดูไม่โปร แบบว่าๆ ยังอ่อนอ่ะครับ....

filename: 01.jpg

Warning: fopen(html/01 หน้าปก.html) [function.fopen]: failed to open stream: No such file or directory in E:\AppServ\www\index.php on line 14

Warning: fwrite(): supplied argument is not a valid stream resource in E:\AppServ\www\index.php on line 15

Warning: fclose(): supplied argument is not a valid stream resource in E:\AppServ\www\index.php on line 16
filename: .jpg

Warning: fopen(html/.html) [function.fopen]: failed to open stream: No such file or directory in E:\AppServ\www\index.php on line 14


ใส่ พาทใหม่ผิดอ่ะ

$newpath="html/".$files[0].".html"; << แก้เป็น

$newpath=$_SERVER['DOCUMENT_ROOT']."/html/".$files[0].".html";

ตรง html เปลี่ยนเป็น DIR ที่จะเก็บไฟล์ก็ได้นะ

navico

ต้องมีโฟลเดอร์ images ใส่รูป
โฟลเดอร์ html สำหรับวางโค้ด ด้วยครับ...
ลองปรับๆดูครับ

tenzamak

ได้แล้วครับ แจ่มจริง ลืมสร้างโฟเดอร์ html นี่เอง
[direct=https://www.asiagb.com/hosting/]host[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/host-inter/]host inter[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/host-singapore/]hosting singapore[/direct]ราคาเริ่มต้นที่ 500/ปี
[direct=https://www.asiagb.com/vps-2/]vps[/direct]ราคาเริ่มต้นที่ 500/เดือน