Page 1 of 1

cr2 php problem

Posted: 2013-04-10T23:44:43-07:00
by ChrisHESS
Hello,

I need help for print an image withe a script in my page. My file source in a cr2 file to print in ma page in jpeg.

Code: Select all

<?php
#$url = './IMG_6968.JPG';
$url = './IMG_6968.CR2';

$canvas = new Imagick($url);

/* Définition du format à JPEG */
$canvas->setImageFormat('JPEG');

/* Affiche l'image */
header("Content-Type: image/JPEG");
echo $canvas;
?>
If I run this script, I obtain a whit paper, but if I change the source file in a jpeg file, I obtain ma picture.

Code: Select all

$url = './IMG_6968.JPG';
phpinfo:

Code: Select all

imagick
imagick module	enabled
imagick module version 	3.1.0RC1
imagick classes 	Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version 	ImageMagick 6.6.9-7 2012-08-17 Q16 http://www.imagemagick.org
ImageMagick copyright 	Copyright (C) 1999-2011 ImageMagick Studio LLC
ImageMagick release date 	2012-08-17
ImageMagick number of supported formats: 	206
ImageMagick supported formats 	3FR, A, AAI, AI, ART, ARW, AVI, AVS, B, BGR, BGRA, BMP, BMP2, BMP3, BRF, C, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FITS, FRACTAL, FTS, G, G3, GIF, GIF87, GRADIENT, GRAY, GROUP4, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, J2C, JNG, JP2, JPC, JPEG, JPG, JPX, K, K25, KDC, LABEL, M, M2V, M4V, MAC, MAP, MAT, MATTE, MIFF, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NULL, O, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, R, RADIAL-GRADIENT, RAF, RAS, RGB, RGBA, RGBO, RLA, RLE, SCR, SCT, SFW, SGI, SHTML, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, Y, YCbCr, YCbCrA, YUV

Directive	Local Value	Master Value
imagick.locale_fix	0	0
imagick.progress_monitor	0	0
My question is what I must doing for print my cr2 file in the script ?

they are an example of a cr2 file:
http://www.envoyercefichier.com/files/I ... 87761.html
it is a French site [free], validity time 20 days for the link, op to 5 April 2013.

In advance, thanks for your help. :)

Re: cr2 php problem

Posted: 2013-04-11T00:16:50-07:00
by snibgo
Your IM version is very old, so your version of dcraw (which reads the CR2 file) is probably also very old.

I suppose PHP doesn't report errors. Try it from the command line:

Code: Select all

convert IMG_6968.CR2 x.jpg
What happens?

Re: cr2 php problem

Posted: 2013-04-11T01:00:36-07:00
by ChrisHESS
Hello snibgo,

I'm under Ubuntu and I see a litel problem when i will open the cr2 file him self. They is a totaly transparancy backgrund under ubuntu without picture, but i shered the folder and i open it under Win7; that is correctly open.

see what hapen:

Code: Select all

administrateur@serveur01:~$ cd /var/images/film.local-photo-images-cr2/view/photo/CD Photo CD 84/Waska - 20130309
bash: cd: /var/images/film.local-photo-images-cr2/view/photo/CD: Aucun fichier ou dossier de ce type
administrateur@serveur01:~$ cd "/var/images/film.local-photo-images-cr2/view/photo/CD Photo CD 84/Waska - 20130309"
administrateur@serveur01:/var/images/film.local-photo-images-cr2/view/photo/CD Photo CD 84/Waska - 20130309$ convert IMG_6968.CR2 IMG_6968.jpg
sh: 1: ufraw-batch: not found
convert: Échec de la délégation `"ufraw-batch" --silent --create-id=also --out-type=png --out-depth=16 "--output=%u.png" "%i"' @ error/delegate.c/InvokeDelegate/1058.
convert: impossible d'ouvrir l'image `/tmp/magick-HnNoEdkl.ppm':  @ error/blob.c/OpenBlob/2587.
convert: nom de fichier d'image absent `IMG_6968.jpg' @ error/convert.c/ConvertImageCommand/3011.
administrateur@serveur01:/var/images/film.local-photo-images-cr2/view/photo/CD Photo CD 84/Waska - 20130309$ 

I think they most open correctly the cr2 file first and afte convert in second time. But how open correctly th cr2 file ? Has some body an idea how to do that ?

thanks.

Re: cr2 php problem

Posted: 2013-04-11T01:24:28-07:00
by ChrisHESS
the defauld image viewer don't open cr2 files, so i use gimp.

http://www.madox.net/blog/2008/11/25/ho ... in-ubuntu/

But that dosen't solve my problem about imgemagick. :(

Re: cr2 php problem

Posted: 2013-04-11T01:45:20-07:00
by snibgo

Code: Select all

convert IMG_6968.CR2 IMG_6968.jpg
sh: 1: ufraw-batch: not found
"convert" is trying to use "ufraw-batch" to read the image, but it isn't installed.