0
我在手术/ PatientBundle/Constroller/RegistrationPatientBundleController和Surgery/PatientBundle/Resources/public/images/test.jpg中有控制器。我有一个图像。这幅图像的路径如何?我在我的控制器中试过这个代码PHP GD库,Symfony中图像的路径
public testAction(){
header ('Content-Type: image/jpeg');
$image = imagecreatefromjpeg("../Resources/public/images/test.jpg");
imagejpeg($image);
但是找不到文件。
我不得不添加 “/”,但它的工作原理$图像= imagecreatefromjpeg(__ DIR __ '/ .. /资源/公/图片/ sara.jpg'); – konadrian 2013-02-14 15:12:51