0

I want to use zenphoto with my symfony2 website. I would do so by making calls to zenphoto to retrieve images. Here's a non-symfony2 coding example from another one of my sites that it would use as a basis:

<?php
define('WEBPATH', 'zenphoto');
require_once(WEBPATH . "/zp-core/template-functions.php");

$currentPage = $_SERVER["PHP_SELF"];
$imageNum = 0;
if (isset($_GET['imageNum'])) 
$imageNum = $_GET['imageNum'];

$gallery = new Gallery();
$numAlbums = $gallery->getNumAlbums();
$gallery->getAlbums();
for ($i = 0 ; $i < $numAlbums; $i++)
{
$album = $gallery->getAlbum($i);
$title = $album->getTitle();
if ($title == "Overview") break;
} 
$album->getImages();
$totalImages = $album->getNumImages() - 1;
$image = $album->getImage($imageNum);
$sizedImage = $image->getSizedImage(600);
?>

There's more code buried in the HTML. All the code would end up in a controller. My question is how to best integrate zenphoto if at all. I could just install the code independent of the framework, but I imagine there's a better way.

There's a whole front end for uploading and managing images as well as admin functions. These web pages would be independent of Symfony as it doesn't seem possible to integrate them.

4

1 回答 1

0

我采用了将库包含到控制器中的简单方法。

define('SERVERPATH',$_SERVER['DOCUMENT_ROOT'] . "/zenphoto");
define('WEBPATH','/zenphoto');
require_once(SERVERPATH.'/zp-core/template-functions.php');

zenphoto 目录与我的 symfony 目录处于同一级别。这很有效,但是当我尝试对 API 进行简单调用时,它在 zenphoto 代码中失败了。当我在zenphoto 论坛上询问该问题时,我被告知我必须进行大量手动设置才能使其正常工作。在这一点上,我放弃了,将我的图像放在 flickr 上并使用他们的 API。

于 2013-11-01T17:16:46.320 回答