将DCOM转换为JPG

时间:2014-01-20 14:13:14

标签: php

我需要将DCOM图像转换为JPG图像,我正在使用this site中的class_dicom.php。 但是我无法在var_dump()中保存转换后的图像。以下是回复:

object(dicom_convert)#1 (5) {
    ["file"] => string(62) "img/dcom/1.2.826.0.1.3680043.2.634.0.12779.2012316.9235.11.dcm"
    ["jpg_file"] => string(66) "img/dcom/1.2.826.0.1.3680043.2.634.0.12779.2012316.9235.11.dcm.jpg"
    ["tn_file"] => string(69) "img/dcom/1.2.826.0.1.3680043.2.634.0.12779.2012316.9235.11.dcm_tn.jpg"
    ["jpg_quality"] => int(100)
    ["tn_size"] => int(125)
}

所以,据我所知,在jpg_file中,我保存了(?)JPG图像?如果没有,我该如何保存?

因为我使用

$jpg = imagecreatefromjpeg('http://localhost/'.$d->jpg_file);
imagejpeg($jpg, NULL);`

我遇到了错误

Warning: imagecreatefromjpeg(http://localhost/img/dcom/1.2.826.0.1.3680043.2.634.0.12779.2012316.9235.11.dcm.jpg) [function.imagecreatefromjpeg]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in O:\home\localhost\www\dcm_to_jpg.php on line 29

Warning: imagejpeg(): supplied argument is not a valid Image resource in O:\home\snimki\www\dcm_to_jpg.php on line 30

所有人都可以提出问题吗?

UPD1:

好吧,正如我所看到的,我无法保存转换后的图像,因此我无法访问不存在的文件...所以我有第二个问题,任何人都可以帮我保存转换后的JPG图片我来自class_dicom.php班......我找不到保存文件的功能......

1 个答案:

答案 0 :(得分:0)

试试这个。

header("Content-type: image/jpeg");

echo file_get_contents($imgPath); //$imgPath -> img/dcom/1.2.826.0.1.3680043.2.634.0.12779.2012316.9235.11.dcm_tn.jpg