git-svn-id: https://msi/svn/firstRepo/Service/trunk@23 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
require_once "./myDropBoxObj.php";
|
||||
use PHPImageWorkshop\ImageWorkshop;
|
||||
require_once('./PHPImageWorkshop/ImageWorkshop.php'); // Be sure of the path to the class
|
||||
|
||||
date_default_timezone_set("Europe/Rome");
|
||||
|
||||
$dirRicetteDropBox = "IlLievitario/Images/Ricette";
|
||||
|
||||
$tmpFileName = "C:/Users/Denis/Desktop/Chiaravalle/Jpg/DSC_7731.jpg";
|
||||
$ext = pathinfo($tmpFileName, PATHINFO_EXTENSION);
|
||||
|
||||
$idRicette = 5;
|
||||
|
||||
$newID = 125;
|
||||
|
||||
$imageFileName = $newID . "_full_ricetta." . $ext;
|
||||
|
||||
$thumbFileName = $newID . "_thumb_ricetta." . $ext;
|
||||
|
||||
$dropBoxObj = new myDropBox();
|
||||
|
||||
$folder = $dirRicetteDropBox . "/" . $idRicette;
|
||||
/*
|
||||
echo $dropBoxObj->GetLink($folder . "/" . $imageFileName);
|
||||
|
||||
return;
|
||||
*/
|
||||
$layer = ImageWorkshop::initFromPath($tmpFileName);
|
||||
|
||||
echo $layer->getImage()->image_type;
|
||||
return;
|
||||
|
||||
$layer->resizeByLargestSideInPixel(640, true);
|
||||
|
||||
$layer->save(dirname($tmpFileName), $imageFileName);
|
||||
|
||||
$imgData = addslashes(file_get_contents($tmpFileName));
|
||||
|
||||
$layer->resizeByLargestSideInPixel(300, true);
|
||||
|
||||
$layer->save(dirname($tmpFileName), $thumbFileName);
|
||||
|
||||
try {
|
||||
$dropBoxObj->CreateFolder($folder);
|
||||
} catch (DropboxException $ex) {
|
||||
|
||||
}
|
||||
|
||||
$dropBoxObj->UploadFile(dirname($tmpFileName) . "/" . $imageFileName, $folder . "/" . $imageFileName);
|
||||
|
||||
$dropBoxObj->UploadFile(dirname($tmpFileName) . "/" . $thumbFileName, $folder . "/" . $thumbFileName);
|
||||
Reference in New Issue
Block a user