Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Oblaten

Pages: [1]
1
Hi,

I'm using different mods which are all work fine in 4images 1.7.6 (e.g. IPTC V.1.7.6 Suchfelder erweiterung by Rembrandt or [MOD] Batch Copy/Move/Edit Images by V@no) and are a BIG help (thank you guys!).

What is missing is a mod or plugin for writing iptc data created with 4images INTO images (also automatically into cropped od copied images). Right now all modifications of metadata are written into the database, which works fine for all the images stored within 4images. But if you download one or more images that was purely keyworded in 4images it has no metadata in it. Thats a pitty. I know that GD Library by default deletes all metadata when cropping an image or creating thumbnails. But there should be a possibility to write these database entries into jpg via php.

I looked into the net and found at http://de.php.net/function.iptcembed :
Code: [Select]
<?

    /************************************************************\
   
        IPTC EASY 1.0 - IPTC data manipulator for JPEG images
           
        All reserved www.image-host-script.com
       
        Sep 15, 2008
   
    \************************************************************/

    DEFINE('IPTC_OBJECT_NAME', '005');
    DEFINE('IPTC_EDIT_STATUS', '007');
    DEFINE('IPTC_PRIORITY', '010');
    DEFINE('IPTC_CATEGORY', '015');
    DEFINE('IPTC_SUPPLEMENTAL_CATEGORY', '020');
    DEFINE('IPTC_FIXTURE_IDENTIFIER', '022');
    DEFINE('IPTC_KEYWORDS', '025');
    DEFINE('IPTC_RELEASE_DATE', '030');
    DEFINE('IPTC_RELEASE_TIME', '035');
    DEFINE('IPTC_SPECIAL_INSTRUCTIONS', '040');
    DEFINE('IPTC_REFERENCE_SERVICE', '045');
    DEFINE('IPTC_REFERENCE_DATE', '047');
    DEFINE('IPTC_REFERENCE_NUMBER', '050');
    DEFINE('IPTC_CREATED_DATE', '055');
    DEFINE('IPTC_CREATED_TIME', '060');
    DEFINE('IPTC_ORIGINATING_PROGRAM', '065');
    DEFINE('IPTC_PROGRAM_VERSION', '070');
    DEFINE('IPTC_OBJECT_CYCLE', '075');
    DEFINE('IPTC_BYLINE', '080');
    DEFINE('IPTC_BYLINE_TITLE', '085');
    DEFINE('IPTC_CITY', '090');
    DEFINE('IPTC_PROVINCE_STATE', '095');
    DEFINE('IPTC_COUNTRY_CODE', '100');
    DEFINE('IPTC_COUNTRY', '101');
    DEFINE('IPTC_ORIGINAL_TRANSMISSION_REFERENCE',     '103');
    DEFINE('IPTC_HEADLINE', '105');
    DEFINE('IPTC_CREDIT', '110');
    DEFINE('IPTC_SOURCE', '115');
    DEFINE('IPTC_COPYRIGHT_STRING', '116');
    DEFINE('IPTC_CAPTION', '120');
    DEFINE('IPTC_LOCAL_CAPTION', '121');

    class iptc {
        var $meta=Array();
        var $hasmeta=false;
        var $file=false;
       
       
        function iptc($filename) {
            $size = getimagesize($filename,$info);
            $this->hasmeta = isset($info["APP13"]);
            if($this->hasmeta)
                $this->meta = iptcparse ($info["APP13"]);
            $this->file = $filename;
        }
        function set($tag, $data) {
            $this->meta ["2#$tag"]= Array( $data );
            $this->hasmeta=true;
        }
        function get($tag) {
            return isset($this->meta["2#$tag"]) ? $this->meta["2#$tag"][0] : false;
        }
       
        function dump() {
            print_r($this->meta);
        }
        function binary() {
            $iptc_new = '';
            foreach (array_keys($this->meta) as $s) {
                $tag = str_replace("2#", "", $s);
                $iptc_new .= $this->iptc_maketag(2, $tag, $this->meta[$s][0]);
            }       
            return $iptc_new;   
        }
        function iptc_maketag($rec,$dat,$val) {
            $len = strlen($val);
            if ($len < 0x8000) {
                   return chr(0x1c).chr($rec).chr($dat).
                   chr($len >> 8).
                   chr($len & 0xff).
                   $val;
            } else {
                   return chr(0x1c).chr($rec).chr($dat).
                   chr(0x80).chr(0x04).
                   chr(($len >> 24) & 0xff).
                   chr(($len >> 16) & 0xff).
                   chr(($len >> 8 ) & 0xff).
                   chr(($len ) & 0xff).
                   $val;
                 
            }
        }   
        function write() {
            if(!function_exists('iptcembed')) return false;
            $mode = 0;
            $content = iptcembed($this->binary(), $this->file, $mode);   
            $filename = $this->file;
               
            @unlink($filename); #delete if exists
           
            $fp = fopen($filename, "w");
            fwrite($fp, $content);
            fclose($fp);
        }   
       
        #requires GD library installed
        function removeAllTags() {
            $this->hasmeta=false;
            $this->meta=Array();
            $img = imagecreatefromstring(implode(file($this->file)));
            @unlink($this->file); #delete if exists
            imagejpeg($img,$this->file,100);
        }
    };
   
   
?>

Example read copyright string:

$i = new iptc("test.jpg");
echo $i->get(IPTC_COPYRIGHT_STRING);

Update copyright statement:
$i = new iptc("test.jpg");
echo $i->set(IPTC_COPYRIGHT_STRING,"Here goes the new data");
$i->write();

NOTE1: Data may be anything, even a binary file. I have so far tested and embedded an MS-Excel file directly to jpeg and it worked just perfect.

NOTE2: The writing purpose, it uses GD Library.

As you see this code works with GD Library which is already part of 4images. Fine. My programming knowledge is less. Not fine. Maybe someone has better php knowledge than me and can create such mod.

- Oblaten

2
Hallo & Gruss an alle!

Habe eine zweisprachige Templateversion erstellt in Englisch und Deutsch mit zusätzlichen Seiten wie Faq und Impressum.
Der Text im content auf der Faq Seite ist sehr lang. Um diesen layouteten Text auch in enlisch anzeigen zu lassen, müsste ich ihn ja in die lang/english/main.php einfügen, was zu einer unglaublich unübersichtlichen, grossen main.php führt.

Meine Frage: gibt es eine Möglichkeit eine html Datei mit dem englischen Text beim Aufruf der englischen Version auf der Faq Seite anzeigen zu lassen und beim Aufruf der deutschen Verison eben eine andere html datei mit dem deutschen Text? Mit includen im content Berich irgendwie? 

Bin für jeden Tip dankbar!

Grüsse Oblaten

3
Guten Tag.

Zuerst mal an die Entwicker: TOLLES Script mit sehr guten Features!
Ich teste gerade Version 1.7.6 und schaue, ob alles möglich ist, was ich brauche. Einige Modifikationen aus dem Forum hier konnte ich schon umsetzen.
Aktuell habe ich eine Frage, für die ich keine Lösung hier und im Netz finden kann:

Zusätzliches Mod: IPTC V.1.7.6 Suchfelder Erweiterung (funktioniert)
Detailansicht öffnet in neuem Fenster: "thumbnail_openwindow" in thumbnail_bit.html aktiviert (funktioniert)

Öffnet man nun ein Detailfenster, verlinken die Schlagworte des Bildes auf eine Suche im gleichen Fenster (also in der Detailansicht). Das führt dazu, dass der Betrachter im Detailfenster "festgehalten" wird. Besser wäre es, wenn die Schlagwortlinks zurück ins Main- / Parentfenster verlinken.

Das Detailfenster wird ja durch ein kleines Javascript geöffnet. Von diesem Fenster müsste man nun mit einem weiteren kleinen Script die Anweisung zur Rückverlinkung im Elternfenster geben. Das sollte gehen. Im Netz fand ich dazu z.B. folgendes (unter dem Menü weiter unten "Altering the Contents of one Window from another" : http://class.scriptschool.com/javascript/101/w3.phtml
Und auf http://www.torsten-horn.de/techdocs/javascript.htm unter Objekt 'window' : In anderem Fenster URL laden:  window.opener.parent.frames[0].location.href = URL;

Aber ich krieg es einfach nicht hin. Vielleicht gibt es ja auch eine einfachere Lösung?

Grüsse von Oblaten

Pages: [1]