thumbnailPhoto attribute issue
Hi Shaun
First off great extension, thank you.
I have noticed that in the latest version 2.0.3 the thumbnailPhoto attribute doesn't seem to pull through.
I initially thought I was doing something wrong but then noticed that the field wasn't pulling through in the debug screen either, I also noticed a couple of other fields were not pulling through either .. objectGUID and objectSid
I then had a play with your PHP LDAP Debug script and the fields pull through fine on that.
I've attached a screen shots of both screens for reference.
Happy to have a look myself if you can point me in the right direction.
cheers


I have done a hack on the profile plugin ... profile.php there may be a better way to do this but, hopefully this might help someone short term.
in the addRecords function line 1029 add
if($key=='thumbnailPhoto'){$value=base64_encode($value);};
so that the full function becomes
protected function addRecords($userId, $attributes, $order)
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->insert($query->quoteName('#__user_profiles'))
->columns(
array(
$query->quoteName('user_id'),
$query->quoteName('profile_key'),
$query->quoteName('profile_value'),
$query->quoteName('ordering')
)
);
foreach ($attributes as $key => $value)
{
$key = 'ldap.' . $key;
if($key=='thumbnailPhoto'){$value=base64_encode($value);};
$query->values(
$query->quote((int) $userId) . ', ' .
$query->quote($key) . ', ' .
$db->quote($value) . ', ' .
$query->quote($order)
);
++$order;
}
$db->setQuery($query);
return $db->query();
}
also add this to the update records function line 1055
protected function updateRecords($userId, $attributes)
{
$result = true;
$db = JFactory::getDBO();
$query = $db->getQuery(true);
foreach ($attributes as $key => $value)
{ if($key=='thumbnailPhoto'){$value=base64_encode($value);};
$key = 'ldap.' . $key;
$query->update($query->quoteName('#__user_profiles'))
->set($query->quoteName('profile_value') . ' = ' . $db->quote($value))
->where($query->quoteName('profile_key') . ' = ' . $query->quote($key))
->where($query->quoteName('user_id') . ' = ' . $query->quote((int) $userId));
$db->setQuery($query);
if (!$db->query())
{
$result = false;
}
$query->clear();
}
return $result;
}
image can be pulled out using something like:
may have to create a new field type to use it
Hi, thanks for providing a method for storing thumbnails.
If I remember correctly, my worry was the SQL data size of profile_value in a Joomla install. This was very small (at least in J2.5) and I didn't think it would be big enough for encoded images. There should certainly be a method of base64'ing any field natively though. Will look into this for 2.0.3 and also investigate the field size issue.
Did you have any issues with storing the thumbnail into the DB?
Hi Shaun I "think" that I had to change the #_user_profiles profile_value field to TEXT on one occasion but that may have been an older version of J, the last few installs all look like they are TEXT not TINYTEXT