Jump to content

muckv

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

muckv's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. this is the content of image_info so you see the array $meta is empty but why? <?php class IPTC{ var $meta; var $info; function __construct($image){ $this->image=$image; $this->meta=array( 'credit' => '', 'caption' => '', 'created_timestamp' => 0, 'copyright' => '', 'title' => '', ); $size=getimagesize($image,$info); $this->info=$info; if ( isset ($info['APP13'])) { $iptc=iptcparse($info['APP13']); if ( !empty($iptc['2#110'][0]) ) $meta['credit'] = utf8_encode(trim($iptc['2#110'][0])); elseif ( !empty($iptc['2#080'][0]) ) $meta['credit'] = utf8_encode(trim($iptc['2#080'][0])); if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) $meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]); if ( !empty($iptc['2#120'][0]) ) // caption $meta['caption'] = utf8_encode(trim($iptc['2#120'][0])); if ( !empty($iptc['2#116'][0]) ) // copyright $meta['copyright'] = utf8_encode(trim($iptc['2#116'][0])); if ( !empty($iptc['2#005'][0]) ) // title $meta['title'] = utf8_encode(trim($iptc['2#005'][0])); } } function get_credit(){ return $this->meta['credit']; } function get_timestamp(){ return $this->meta['created_timestamp']; } function get_caption(){ return $this->meta['caption']; } function get_copyright(){ return $this->meta['copyright']; } function get_title(){ return $this->meta['title']; } } $image_info = new IPTC('suzy1.jpg') or die ('kan geen iptc gegevens extracten uit image'); echo $image_info->get_copyright();
  2. I just ran this code and In if IS echoed, i'm really in the dark here <?php class IPTC{ var $meta; var $info; function __construct($image){ $this->image=$image; $this->meta=array( 'credit' => '', 'caption' => '', 'created_timestamp' => 0, 'copyright' => '', 'title' => '', ); $size=getimagesize($image,$info); $this->info=$info; if ( isset ($info['APP13'])) { echo "in if"; $iptc=iptcparse($info['APP13']); if ( !empty($iptc['2#110'][0]) ) $meta['credit'] = utf8_encode(trim($iptc['2#110'][0])); elseif ( !empty($iptc['2#080'][0]) ) $meta['credit'] = utf8_encode(trim($iptc['2#080'][0])); if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) $meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]); if ( !empty($iptc['2#120'][0]) ) // caption $meta['caption'] = utf8_encode(trim($iptc['2#120'][0])); if ( !empty($iptc['2#116'][0]) ) // copyright $meta['copyright'] = utf8_encode(trim($iptc['2#116'][0])); if ( !empty($iptc['2#005'][0]) ) // title $meta['title'] = utf8_encode(trim($iptc['2#005'][0])); } } function get_credit(){ return $meta['credit']; } function get_timestamp(){ return $meta['created_timestamp']; } function get_caption(){ return $meta['caption']; } function get_copyright(){ return $meta['copyright']; } function get_title(){ return $meta['title']; } } $image_info = new IPTC('suzy1.jpg') or die ('kan geen iptc gegevens extracten uit image'); echo $image_info->get_copyright();
  3. Well, Still the same problem, the if structure does get executed cause I follow it while debugging I can see the correct value in meta['copyright'] until the method gets called <?php class IPTC{ var $meta; var $info; function __construct($image){ $this->image=$image; $this->meta=array( 'credit' => '', 'caption' => '', 'created_timestamp' => 0, 'copyright' => '', 'title' => '', ); $size=getimagesize($image,$info); $this->info=$info; if ( isset ($info['APP13'])) { $iptc=iptcparse($info['APP13']); if ( !empty($iptc['2#110'][0]) ) $meta['credit'] = utf8_encode(trim($iptc['2#110'][0])); elseif ( !empty($iptc['2#080'][0]) ) $meta['credit'] = utf8_encode(trim($iptc['2#080'][0])); if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) $meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]); if ( !empty($iptc['2#120'][0]) ) // caption $meta['caption'] = utf8_encode(trim($iptc['2#120'][0])); if ( !empty($iptc['2#116'][0]) ) // copyright $meta['copyright'] = utf8_encode(trim($iptc['2#116'][0])); if ( !empty($iptc['2#005'][0]) ) // title $meta['title'] = utf8_encode(trim($iptc['2#005'][0])); } } function get_credit(){ return $meta['credit']; } function get_timestamp(){ return $nfo['created_timestamp']; } function get_caption(){ return $meta['caption']; } function get_copyright(){ return $meta['copyright']; } function get_title(){ return $meta['title']; } } $image_info = new IPTC('suzy1.jpg') or die ('kan geen iptc gegevens extracten uit image'); echo $image_info->get_copyright(); ?>
  4. hey, when I call the method get_copyright() the array $meta becomes null instead op returning the value of $meta['copyright'] Everything goes well in the constructor, but when that method is called (see above) does anybody see what I did wrong <?php class IPTC{ var $meta; var $image; function __construct($image){ $meta=array(); $this->meta=$meta; $this->image=$image; $meta = array( 'credit' => '', 'caption' => '', 'created_timestamp' => 0, 'copyright' => '', 'title' => '', ); $size=getimagesize($image,$info); if ( isset ($info['APP13'])) { $iptc=iptcparse($info['APP13']); if ( !empty($iptc['2#110'][0]) ) $meta['credit'] = utf8_encode(trim($iptc['2#110'][0])); elseif ( !empty($iptc['2#080'][0]) ) $meta['credit'] = utf8_encode(trim($iptc['2#080'][0])); if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) $meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]); if ( !empty($iptc['2#120'][0]) ) // caption $meta['caption'] = utf8_encode(trim($iptc['2#120'][0])); if ( !empty($iptc['2#116'][0]) ) // copyright $meta['copyright'] = utf8_encode(trim($iptc['2#116'][0])); if ( !empty($iptc['2#005'][0]) ) // title $meta['title'] = utf8_encode(trim($iptc['2#005'][0])); } } function get_credit(){ return $meta['credit']; } function get_timestamp(){ return $meta['created_timestamp']; } function get_caption(){ return $meta['caption']; } function get_copyright(){ return $meta['copyright']; } function get_title(){ return $meta['title']; } } $image_info = new IPTC('suzy1.jpg') or die ('kan geen iptc gegevens extracten uit image'); echo $image_info->get_copyright()or die('geen copyright beschikbaar');
  5. geez thanks ken, you really helped me out thanks
  6. http://localhost/IPTC/index.php From here I make the url going to http://localhost/IPTC/inhoud.php?var=jan (jan is the correct value) print_r($_REQUEST) in inhoud.php gives me no output I will post all my relevant code <?php include("directory.php"); $rootfolder = new folder('.'); global $dirs; $dirs=$rootfolder->scanfdir(); $max=sizeof($dirs); for($i=0;$i<$max;$i++) { //$dirs[] is full of strings, checked and working echo '<A HREF="http://localhost/IPTC/inhoud.php?var='.$dirs[$i].'">'.$dirs[$i].'</A><br>'; } ?> <html> <head> <title>Inhoud</title> </head> <body> <? $var =$_GET['var']; echo $var; print_r($_REQUEST); $path = './IPTC/'.$var; function check_extension($extensie){ ($extensie == 'jpg' || $extensie == 'jpeg' || $extensie == 'gif')? true : false; } function get_images($path){ $files = scandir($path); for($i = 0;$i < sizeof($files);$i++) { $ext = substr($files[$i], strrpos($files[$i], '.') + 1); if(check_extensie($ext)){ $string .= $files[$i].' '; } } return $string; } ?> </body> </html>
  7. PHP Version 5.2.5 Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared" Server API CGI/FastCGI Virtual Directory Support enabled Configuration File (php.ini) Path C:\WINDOWS Loaded Configuration File C:\Program Files\phpDesigner 2008\PHP\php.ini PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Debug Build no Thread Safety enabled Zend Memory Manager enabled IPv6 Support enabled Registered PHP Streams php, file, data, http, ftp, compress.zlib, zip Registered Stream Socket Transports tcp, udp Registered Stream Filters convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.*
  8. well if I look at the url after I clicked the link I see http://url/inhoud.php?var=string so I see that $var has gotten it's correct value
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.