fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [11149] property: images from external url


From: Sigurd Nes
Subject: [Fmsystem-commits] [11149] property: images from external url
Date: Wed, 05 Jun 2013 13:22:40 +0000

Revision: 11149
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11149
Author:   sigurdne
Date:     2013-06-05 13:22:39 +0000 (Wed, 05 Jun 2013)
Log Message:
-----------
property: images from external url

Modified Paths:
--------------
    trunk/property/inc/class.uientity.inc.php
    trunk/property/inc/class.uigallery.inc.php

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2013-06-05 07:51:50 UTC (rev 
11148)
+++ trunk/property/inc/class.uientity.inc.php   2013-06-05 13:22:39 UTC (rev 
11149)
@@ -795,7 +795,7 @@
                        $entity_list = array();
 
                        $entity_list = 
$this->bo->read(array('start_date'=>$start_date,'end_date'=>$end_date, 
'dry_run' => $dry_run));
-
+//_debug_array($entity_list);
                        $uicols = $this->bo->uicols;
 
                        $uicols['name'][]               = 'img_id';
@@ -849,16 +849,25 @@
                                {
                                        $_loc1 = isset($entity_entry['loc1']) 
&& $entity_entry['loc1'] ? $entity_entry['loc1'] : 'dummy';
 
-                                       $_files = $vfs->ls(array(
-                                               'string' => 
"/property/{$this->category_dir}/{$_loc1}/{$entity_entry['id']}",
-                                               'relatives' => 
array(RELATIVE_NONE)));
-       
-                                       if(isset($_files[0]) && $_files[0] && 
in_array($_files[0]['mime_type'], $img_types))
+                                       if(false)
                                        {
-                                               $entity_entry['file_name']      
= urlencode($_files[0]['name']);
-                                               $entity_entry['directory']      
= urlencode($_files[0]['directory']);
-                                               $entity_entry['img_id']         
= $_files[0]['file_id'];
+                                               $entity_entry['file_name']      
= $entity_entry['museumsnr'];
+                                               $entity_entry['directory']      
= urlencode('external_source');
+                                               $entity_entry['img_id']         
= $entity_entry['museumsnr'];
                                        }
+                                       else
+                                       {
+                                               $_files = $vfs->ls(array(
+                                                       'string' => 
"/property/{$this->category_dir}/{$_loc1}/{$entity_entry['id']}",
+                                                       'relatives' => 
array(RELATIVE_NONE)));
+       
+                                               if(isset($_files[0]) && 
$_files[0] && in_array($_files[0]['mime_type'], $img_types))
+                                               {
+                                                       
$entity_entry['file_name']      = urlencode($_files[0]['name']);
+                                                       
$entity_entry['directory']      = urlencode($_files[0]['directory']);
+                                                       $entity_entry['img_id'] 
        = $_files[0]['file_id'];
+                                               }
+                                       }
 
                                        for 
($i=0;$i<count($uicols['name']);$i++)
                                        {

Modified: trunk/property/inc/class.uigallery.inc.php
===================================================================
--- trunk/property/inc/class.uigallery.inc.php  2013-06-05 07:51:50 UTC (rev 
11148)
+++ trunk/property/inc/class.uigallery.inc.php  2013-06-05 13:22:39 UTC (rev 
11149)
@@ -91,6 +91,37 @@
                        $this->bo->save_sessiondata($data);
                }
 
+               private function get_external_source($file, $thumb)
+               {
+                       $file = ltrim($file,'external_source/');
+                       
+                       $url = 
"bkbilde.bergen.kommune.no/fotoweb/cmdrequest/rest/PreviewAgent.fwx?ar=5008&rs=0&pg=0&username=FDV&password=FDV123&sr={$file}*";
+                       
+                       if($thumb)
+                       {
+                               $url .= '&sz=50';
+                       }
+                       else
+                       {
+                               header('Content-Type: image/jpeg');             
        
+                       }
+
+/*
+                       $file = 'http://somehosted.com/file.pdf'; // URL to the 
file
+
+                       $contents = file_get_contents($file); // read the 
remote file
+*/
+
+                       $ch = curl_init ($url);
+                       curl_setopt($ch, CURLOPT_HEADER, 0);
+                       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+                       curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
+                       $raw=curl_exec($ch);
+                       curl_close ($ch);
+                       echo $raw;
+
+               }
+               
                function view_file()
                {
                        $GLOBALS['phpgw_info']['flags']['noheader'] = true;
@@ -107,6 +138,11 @@
 
 
                        $directory = explode('/', $file);
+                       
+                       if($directory[0] == 'external_source')
+                       {
+                               return $this->get_external_source($file, 
$thumb);
+                       }
 
                        $location_info = $this->bo->get_location($directory);
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]