Problem with image
15 posts
• Page 1 of 1
Hi, I have dataface v. 0.7.1 and when i try to view a image from db i have this error:
trovato:/tmp/GestFarm-diagnostica-image-0?iddignostica=23&-1189668558 Warning: fopen(/tmp/GestFarm-diagnostica-image-0?iddignostica=23&-1189668558) [function.fopen]: failed to open stream: Invalid argument in E:\Programmi\OCS Inventory NG\xampp\htdocs\dataface\Dataface\Application\blob.php on line 174 Warning: Cannot modify header information - headers already sent by (output started at E:\Programmi\OCS Inventory NG\xampp\htdocs\dataface\Dataface\Application\blob.php:173) in E:\Programmi\OCS Inventory NG\xampp\htdocs\dataface\Dataface\Application\blob.php on line 229 Warning: Cannot modify header information - headers already sent by (output started at E:\Programmi\OCS Inventory NG\xampp\htdocs\dataface\Dataface\Application\blob.php:173) in E:\Programmi\OCS Inventory NG\xampp\htdocs\dataface\Dataface\Application\blob.php on line 230 database name is GestFarm, table name is Diagnostica and field is: iddiagnostica : Primary key autoincremental data : Date field Image : Blob Imaga_mine : varchar(10) default="jpeg" i try to set: class tables_Diagnostica { function image__htmlValue(&$record) { return 'display('image').'">'; } }
There are 2 ways to fix this issue: 1. add a valid path to be used as a cache directory to the first line of your conf.ini file: e.g. cache_dir = "C:\xamp\path\to\tmp\folder" and make sure that this folder is writable on the webserver. 2.Ê You can add some more "smartness" to the source code.Ê In Dataface/Application.php on line 382 you'll see something like: ÊÊÊ ÊÊÊ if ( !isset( $this->_conf['cache_dir'] ) ){ Change it to: if ( !isset( $this->_conf['cache_dir'] ) ){ Ê ÊÊ
Hi!
If I write this in Dataface/Application.php : if ( !isset( $this->_conf['cache_dir'] ) ){ if ( ini_get('upload_tmp_dir') ) $this->_conf['cache_dir'] = ini_get('upload_tmp_dir'); else $this->_conf['cache_dir'] = '/tmp'; } I get this error when open link to image (Action getBlog) = Warning: fopen(E:\Programmi\OCS Inventory NG\xampp\tmp/GestFarm-diagnostica-image-0?iddignostica=23&-1190636882) [function.fopen]: failed to open stream: Invalid argument in E:\Programmi\OCS Inventory NG\xampp\htdocs\dataface\Dataface\Application\blob.php on line 174 Warning: Cannot modify header information - headers already sent by (output started at E:\Programmi\OCS Inventory NG\xampp\htdocs\dataface\Dataface\Application\blob.php:173) in E:\Programmi\OCS Inventory NG\xampp\htdocs\dataface\Dataface\Application\blob.php on line 229 Warning: Cannot modify header information - headers already sent by (output started at E:\Programmi\OCS Inventory NG\xampp\htdocs\dataface\Dataface\Application\blob.php:173) in E:\Programmi\OCS Inventory NG\xampp\htdocs\dataface\Dataface\Application\blob.php on line 230 Then if I change conf.ini adding: cache_dir = "E:\tmp" with tmp folder writeable for everyone I get this: Warning: fopen(E:\tmp/GestFarm-diagnostica-image-0?iddignostica=24&-1190637166) [function.fopen]: failed to open stream: Invalid argument in E:\Programmi\OCS Inventory NG\xampp\htdocs\dataface\Dataface\Application\blob.php on line 174 Thanks For Help!
Hmm.. This may be a limitation in Windows file names. Dataface tries to cache the blob files temporarily..
Perhaps try simplifying cache file names. In the file Dataface/Application/blob.php, you should find a section like:
in the _handleGetBlob() function Try adding the following right after it: $cachePath = $this->_conf['cache_dir'].'/'.md5($cachePath); That should produce a more friendly file name. This isn't a perfect solution as there is a small probability of collisions in file names with this strategy... but it will at least tell us whether that is the problem. -Steve
HI Very very good work! Now working all, I have crete this method:
function image__htmlValue(&$record) { if ($record->val('image_minetype')=="application/x-shockwave-flash") { return ' '; } elseif ($record->val('image_minetype')=="application/pdf") { return ''; //return 'display('image').'"> link '; } else return 'display('image').'">'; } and I can see Pdf, flash and image. in fields.ini I have put: [image_minetype] widget:type = select vocabulary = mime_type [image] type = container widget:type = file widget:label = "Upload" allowed_extensions = pdf,swf,jpeg and in valueslist.ini [mime_type] application/x-shockwave-flash = flash application/pdf = pdf image/jpeg = image JPEG now I have last problem: I wont to upload only file with extensions = pdf,swf,jpeg but don't work! where I have make mistake? Thank for all!!
OK.. there are a couple of things here:
1. It should be "Type = container" and not "type = container" (case sensitive) 2. Are you using a container field or a blob field. In the container field strategy (recommended), you use a varchar field to store the file name. In a blob field strategy, you actually store the file in the db. I'm not sure if the allowed_extensions directive works for blob fields (i'll have to look). It was more important for container fields because the files are actually being stored on the file system and there are potential security issues... none the less it would be good to have this feature for blobs too. 3. You cite a couple of places in your sample code when you are using 'image_minetype'. Do you mean 'image_mimetype'? -Steve
Hi I have change minetype to mimetype, and now working fine, image_filename too....Sorry for error!!!!
with this fields.ini allowed_extensions don't work, but is not a great problems! Thx for All!! [image] Type = blob widget:type = file allowed_extensions = pdf,swf,jpeg
Hi Steve,
Sorry to renew an old thread but I just wanted to advise that I had the same problems using a windows server with the cachepath name. Adding the line
as advised above fix the problem. Perhaps this can be included in future releases. Regards, Paul
HI!!
I have same problemes with creation file on windows server, the error is: Warning: fopen(d:/tmp/riparazioni-riparazione-Allegato-0?ID=26&-1238059310) [function.fopen]: failed to open stream: No error in D:\xampp\htdocs\xataface-1.1.5r2\Dataface\Application\blob.php on line 173 the problems is file name with "?" can't create on windows! using a simple str_replace "?", ":" ????
Re: Problem with imageHi, I have same problem, and with replace $found=str_replace("?","-",$found); it works!
Is possible to make the update on all release of xatafce for prevent problems on windows server??
Re: Problem with imageHi at line 195 of xataface-1.2.6\Dataface\Application\blob.php
I have change
to
to prevent warning message
Re: Problem with imageFixed in SVN rev 2071. Will be included in next release.
15 posts
• Page 1 of 1
Who is onlineUsers browsing this forum: No registered users and 2 guests |