git-svn-id: https://msi/svn/firstRepo/Service/branches/Manut_2.2.3@50 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
@@ -12,12 +12,12 @@ $app->get('/photo/thumbnail/:imageID(/:createImgTag)', function ($imageID, $crea
|
||||
$mysqlconnetion->disconnetti();
|
||||
|
||||
|
||||
$ext = "";
|
||||
if ($retObj["type_format"] == "image/jpeg") {
|
||||
$ext = "png";
|
||||
/*if ($retObj["type_format"] == "image/jpeg") {
|
||||
$ext = "jpeg";
|
||||
} else if ($retObj["type_format"] == "image/png") {
|
||||
$ext = "png";
|
||||
}
|
||||
}*/
|
||||
|
||||
$folder = $dirRicetteDropBox . "/" . $retObj["id_ricette"];
|
||||
|
||||
|
||||
+4
-4
@@ -47,7 +47,7 @@ $app->delete('/photo/:imageID', function ($imageID) use ($app,$dirRicetteDropBox
|
||||
$mysqlconnetion->disconnetti();
|
||||
});
|
||||
|
||||
$app->post('/photos', function () use ($app, $dirRicetteDropBox) {
|
||||
$app->post('/photo', function () use ($app, $dirRicetteDropBox) {
|
||||
$idRicette = $app->request()->post('ricetta_id');
|
||||
$profileID = $app->request()->post('keyStore');
|
||||
$tmpFileName = $_FILES['image']["tmp_name"];
|
||||
@@ -74,14 +74,14 @@ $app->post('/photos', function () use ($app, $dirRicetteDropBox) {
|
||||
|
||||
$thumbFileName = $newID . "_thumb_ricetta." . $ext;
|
||||
|
||||
resizeImage($dropBoxObj, $layer, 80, dirname($tmpFileName), $thumbFileName, $folder);
|
||||
makeThumbImage($dropBoxObj, $layer, 80, dirname($tmpFileName), $thumbFileName, $folder);
|
||||
|
||||
$mysqlconnetion->disconnetti();
|
||||
|
||||
echo $newID;
|
||||
});
|
||||
|
||||
$app->put('/photos/:imageID', function ($imageID) use ($app, $dirRicetteDropBox) {
|
||||
$app->put('/photo/:imageID', function ($imageID) use ($app, $dirRicetteDropBox) {
|
||||
$tmpFileName = $_FILES['image']["tmp_name"];
|
||||
$layer = ImageWorkshop::initFromPath($tmpFileName);
|
||||
// istanza della classe
|
||||
@@ -103,7 +103,7 @@ $app->put('/photos/:imageID', function ($imageID) use ($app, $dirRicetteDropBox)
|
||||
|
||||
$thumbFileName = $newID . "_thumb_ricetta." . $ext;
|
||||
|
||||
resizeImage($dropBoxObj, $layer, 80, dirname($tmpFileName), $thumbFileName, $folder);
|
||||
makeThumbImage($dropBoxObj, $layer, 80, dirname($tmpFileName), $thumbFileName, $folder);
|
||||
|
||||
$mysqlconnetion->disconnetti();
|
||||
|
||||
|
||||
+6
-1
@@ -169,11 +169,16 @@ $app->get('/ricetta/header/:itemID', function ($itemID) use ($app) {
|
||||
$mysqlconnetion = new MysqlClass;
|
||||
$query = "UPDATE ricette Set valutazione = valutazione + 1 WHERE ricette.ID = " . $itemID;
|
||||
$mysqlconnetion->executeQuery($query);
|
||||
$query = "SELECT id_categoria, categorie.name AS categoria_name, ricette.ID AS ricetta_id, titolo, procedimento, autore, link_fonte, link_youtube, valutazione FROM ricette INNER JOIN categorie ON categorie.ID = ricette.id_categoria WHERE ricette.ID = " . $itemID;
|
||||
$query = "SELECT ID from immagini WHERE published = 1 AND ID_RICETTE = " . $itemID;
|
||||
$photos = $mysqlconnetion->queryToObject($query);
|
||||
$query = "SELECT id_categoria, categorie.name AS categoria_name, ricette.ID AS ricetta_id, " .
|
||||
"titolo, procedimento, autore, link_fonte, link_youtube, valutazione FROM ricette " .
|
||||
"INNER JOIN categorie ON categorie.ID = ricette.id_categoria WHERE ricette.ID = " . $itemID;
|
||||
$retObj = $mysqlconnetion->queryToObject($query);
|
||||
$retObj[0]["titolo"] = html_entity_decode($retObj[0]["titolo"], ENT_COMPAT | ENT_HTML401, 'ISO-8859-1');
|
||||
$retObj[0]["procedimento"] = html_entity_decode($retObj[0]["procedimento"], ENT_COMPAT | ENT_HTML401, 'ISO-8859-1');
|
||||
$data = $retObj[0]["link_youtube"];
|
||||
$retObj[0]["foto"] = $photos;
|
||||
$output = array();
|
||||
if ($data != "") {
|
||||
$d = explode(";", $data);
|
||||
|
||||
+18
@@ -98,4 +98,22 @@ function resizeImage($dropBoxObj, $layer, $size, $dir, $fileName, $dirDropBox)
|
||||
$dropBoxObj->UploadFile($fullPath, $dirDropBox . "/" . $fileName);
|
||||
}
|
||||
|
||||
function makeThumbImage($dropBoxObj, $layer, $size, $dir, $fileName, $dirDropBox)
|
||||
{
|
||||
$fileName = str_replace(".jpg", ".png", $fileName);
|
||||
$fileName = str_replace(".jpeg", ".png", $fileName);
|
||||
$fullPath = $dir . "/" . $fileName;
|
||||
$layer->resizeInPixel($size, $size, true, 0, 0, 'MM');
|
||||
$layer->save($dir, $fileName);
|
||||
|
||||
try {
|
||||
$dropBoxObj->CreateFolder($dirDropBox);
|
||||
} catch (DropboxException $ex) {
|
||||
}
|
||||
|
||||
$dropBoxObj->UploadFile($fullPath, $dirDropBox . "/" . $fileName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user