Changeset 4298 in subversion
- Timestamp:
- Dec 1, 2010 2:39:36 PM (2 years ago)
- Location:
- branches/devel-addressbook/program
- Files:
-
- 3 edited
-
include/rcube_vcard.php (modified) (1 diff)
-
steps/addressbook/func.inc (modified) (1 diff)
-
steps/addressbook/show.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-addressbook/program/include/rcube_vcard.php
r4297 r4298 234 234 break; 235 235 236 case 'photo': 237 $encoded = base64_decode($value, true) ? true : false; 238 $this->raw['PHOTO'][] = array(0 => $encoded ? $value : base64_encode($value), array('BASE64')); 239 break; 240 236 241 case 'email': 237 242 $this->raw['EMAIL'][] = array(0 => $value, 'type' => array_filter(array('INTERNET', $type))); -
branches/devel-addressbook/program/steps/addressbook/func.inc
r4297 r4298 325 325 if ($coltypes['photo']) { 326 326 if ($record['photo']) 327 $pic_img = $ browser->imgdata ? 'data:image/jpeg;base64,' . $data : $RCMAIL->url(array('_action' => 'photo', '_cid' => $record['ID'], '_source' => $_REQUEST['_source']));327 $pic_img = $RCMAIL->url(array('_action' => 'photo', '_cid' => $record['ID'], '_source' => $_REQUEST['_source'])); 328 328 $img = html::img(array('src' => $pic_img, 'border' => 1, 'alt' => '')); 329 329 if ($edit_mode) { -
branches/devel-addressbook/program/steps/addressbook/show.inc
r4297 r4298 29 29 if ($RCMAIL->action == 'photo') { 30 30 if ($record['photo']) { 31 // assume image/jpg base64 encoded 32 $data = base64_decode(is_array($record['photo']) ? $record['photo'][0] : $record['photo'], true); 31 $data = is_array($record['photo']) ? $record['photo'][0] : $record['photo']; 32 if (!preg_match('![^a-z0-9/+-]!i', $data)) 33 $data = base64_decode($data, true); 33 34 } 34 35 35 header('Content-Type: image/jpeg'); 36 // check some magic numbers to detect image type 37 $type = 'jpeg'; 38 if (preg_match('/^\x89\x50\x4E\x47/', $data)) 39 $type = 'png'; 40 else if (preg_match('/^\x47\x49\x46\x38/', $data)) 41 $type = 'png'; 42 //else if (preg_match('/^\xFF\xD8\xFF\xE0/', $data)) 43 // $type = 'jpeg'; 44 45 header('Content-Type: image/' . $type); 36 46 echo $data ? $data : file_get_contents('program/blank.gif'); 37 47 exit;
Note: See TracChangeset
for help on using the changeset viewer.
