วิธีแก้ปัญหา WordPress ไม่สามารถ Crop Image ได้บน XAMPP local server

ในกรณีที่เราติดตั้ง WordPress และทดสอบบนเครื่องแบบ localhost ซึ่งส่วนใหญ่เป็นการพัฒนาและทดสอบก่อนการนำเอา WordPress เว็บไปใช้งานจริง ซึ่งจะมีขั้นตอนหนึ่งคือการ upload รูปภาพและเพื่อให้สอดคล้องกับ template ที่กำลังทำการตั้งค่าจำเป็นต้องทำการ crop รูปภาพให้มีขนาดตามต้องการ แต่พบว่าไม่สามารถทำได้มีข้อความแจ้งผิดพลาด “There has been an error cropping your image.” ขึ้นมา ต่อไปนี้คือขึ้นตอนการแก้ปัญหานี้

1. เปิดโปรแกรม XAMPP Control Panel

3. กดปุ่ม Ctrl+f จะปรากฎ Text Box ให้กรอกข้อความเพื่อค้นหา ให้กรอกคำว่า “gd” ดังแสดงในรูป จากนั้นกดปุ่มค้นหา (ปุ่มลูกศรชี้ลง) จะปรากฎบรรทัด “;extension=gd” ให้ลบเครื่องหมาย “;” ออกจะได้ “extension=gd” จากนั้น Save และปิดไฟล์ php.ini

4. Restart Apache โดยการกดปุ่ม Stop และ Start

อ.ดร.วัชรินทร์ สาระไชย
อ.ดร.วัชรินทร์ สาระไชย

Hello! I’m Watcharin Sarachai, an enthusiastic and dedicated educator with a passion for advancing the field of computer science. I hold a Ph.D. in Computer Science from Chiang Mai University, where I focused on cutting-edge research in Machine Learning, Computer Programming, and Embedded Systems.

Articles: 18