Accessing Zenphoto from Symfony Framework

I have a Symfony framework installed in /symfony on my web sever. I also have zenphoto installed in /zenphoto at the same level. Zenphoto is up and running and I've added albums and images. Now I'm trying to make calls from Symphony to access the db. I'm starting with getting the path to the library to work with the following:

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

When I just include that line in one of my controllers, I get the error:

The requested URL /symfony/web/zp-core/setup/index.php was not found on this server.

The invocation of the controller goes through: http://amcolan.loc/symfony/web/app_dev.php

Is there a way around this problem?

Comments

  • acrylian Administrator, Developer
    Sorry, I have no knowledge of the symfony framework as I never used it. Actually Zenphoto is/has its own framework actually.
    http://www.zenphoto.org/news/zenphotos-object-model-framework

    It is neither meant nor tested to be called within other frameworks. The recommended way to accesss ZP functionality outside of Zenphoto is this:
    http://www.zenphoto.org/news/integration-with-existing-sites-and-other-cms#zenphoto-as-a-plugin
  • Thanks for the information. I got the require_once to work with this code:

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

    Unfortunately my first call failed on this line of code:

    $gallery = new Gallery();

    This is the error:

    [17-Oct-2013 10:50:11 America/Los_Angeles] PHP Warning: Invalid argument supplied for foreach() in /Volumes/Data/htdocs/AmColAn/zenphoto/zp-core/functions-basic.php on line 231
    [17-Oct-2013 10:50:11 America/Los_Angeles] PHP Fatal error: Class 'Zetcho\AmColAnBundle\Controller\Gallery' not found in /Volumes/Data/htdocs/AmColAn/symfony/src/Zetcho/AmColAnBundle/Controller/SurnameController.php on line 112

    Here's the code from functions-basic.php starting at line 231:

    foreach ($_zp_cachefileSuffix as $key => $type) {
    if ($type) {
    $_zp_supported_images[] = strtolower($key);
    }
    }

    It looks like zenphoto is not going to work inside of a symfony framework.
  • acrylian Administrator, Developer
    Zenphoto requires a special context setup like quite some global variables. You probably have to setup all those manually. Probably this is the same reason why for example the "Zenphoto as plugin" way does not work with a lot other CMS like WP.

    Does anything speak against using directly what Zenphoto provides? Otherwise you might need to create a kind of bridge to setup the contextes.
  • I planned to use zenphoto directly to upload and manage images. The calls from the symfony framework were just to display the images in context.
  • acrylian Administrator, Developer
    What exactly do you want to display? The full gallery/album/image functionality? Getting this to work might be a lot more work than just using ZP itself. Is it worth for your purpose to do everything again ZP itself already offers? I don't know symfony but maybe you could then just do it with it itself.

    If it is just latest images or the like outside you could try to use the rss feeds.
  • The images I want to display are a very small part of the web site content. It has already has its own user system and a tracking database. I've coded the same interface before on a plain php site and I plan to do it again on another one. I was even thinking of using it on a Ruby on Rails site, but I know that won't work.

    Thanks for all your help on this issue.
  • acrylian Administrator, Developer
    Ok, I fear I can't help further. But if you get anything going let us know as it might interest others. We might then add a link on the related user guide articles then.
Sign In or Register to comment.