FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » accessing nested unknown unserialized objects
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
accessing nested unknown unserialized objects [message #183638] Mon, 04 November 2013 20:37 Go to previous message
catseye.chandra is currently offline  catseye.chandra
Messages: 1
Registered: November 2013
Karma:
Junior Member
Hello PHP users,

I'm currently fiddling with phpgallery 1.x import/tweaking, and by using unserialize got access to an album metadata.

unserialize gives a big array, with nested objects as each elt.

I cannot find the right way to wright the accessor to two fields of real interest :

$this->image->name

and

$this->caption


for now I got :

<?
$fh = fopen("photos.dat", "r");
$buf = fread($fh, 1024000);
$arr = unserialize($buf);
foreach ($arr as &$o) {
print $o->image->name;
print $o->caption;
flush();
}
?>

also:

<?
$fh = fopen("photos.dat", "r");
$buf = fread($fh, 1024000);
$arr = unserialize($buf);
foreach ($arr as &$o) {
//print_r($o);
printf("%s : %s\n", $o->image->name, $o->caption);
flush();
};
?>

but nothing get printed :-(

Thanks for any help - I'm a beginner.

--

Array
(
[0] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => AlbumItem
[image] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => Image
[name] => aaa
[type] => jpg
[width] => 700
[height] => 525
[resizedName] => aaa.sized
[thumb_x] =>
[thumb_y] =>
[thumb_width] =>
[thumb_height] =>
[raw_width] => 1024
[raw_height] => 768
[version] => 38
)
[thumbnail] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => Image
[name] => aaa.thumb
[type] => jpg
[width] => 210
[height] => 158
[resizedName] =>
[thumb_x] =>
[thumb_y] =>
[thumb_width] =>
[thumb_height] =>
[raw_width] => 210
[raw_height] => 158
[version] => 38
)
[preview] =>
[caption] => Gymnocalycium saglione - juin 01
[hidden] =>
[highlight] => 1
[highlightImage] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => Image
[name] => aaa.highlight
[type] => jpg
[width] => 200
[height] => 150
[resizedName] =>
[thumb_x] =>
[thumb_y] =>
[thumb_width] =>
[thumb_height] =>
[raw_width] => 200
[raw_height] => 150
[version] => 38
)
[isAlbumName] =>
[clicks] => 4659
[keywords] =>
[comments] =>
[uploadDate] => 994366657
[itemCaptureDate] => 992529433
[exifData] => Array
(
[File size] => 160119 bytes
[File date] => 2004:12:29 22:25:11
[Camera make] => NIKON
[Camera model] => E880
[Date/Time] => 2001:06:14 16:37:13
[Resolution] => 1024 x 768
[Flash used] => No
[Focal length] => 13.9mm
[Exposure time] => 0.0080 s (1/125)
[Aperture] => f/9.4
[ISO equiv.] => 100
[Metering Mode] => matrix
[Exposure] => program (auto)
)

[owner] => 988373499_1755202938
[extraFields] => Array
(
)
[rank] => 0
[version] => 38
[emailMe] => Array
(
)

[imageAreas] =>
)
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: checking for audio playing ???
Next Topic: detecting a file in use
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 06:15:19 GMT 2024

Total time taken to generate the page: 0.05905 seconds