Search

WinXP, Symphony 2.2RC3.

I have a small script that outputs a text as colored images: Symphony 2.2RC3 -> Symphony_2.2RC3.jpg.

I’m using ashooner’s EFM extension to use this script in XSL. The problem is that I’m getting the error in xslt_error.png attachment. It says that the path is invalid … On php.net forum someone said that it’s about permissions to target folder. I changed the entire workspace settings to 777 but still nothing.

Here’s the function that triggers the error. imagejpg is native PHP function.

imagejpeg($image,$path_to_file,100)

Any ideas? I’m so close to finally automating this process …

Thank you.

Edit #1

solved the path problem. Silly thing … :) but this message remains (see xslt_message.png):

Use of undefined constant result - assumed ‘result’

What’s with this message? When does it occur? In what file and line does it happen?

Edit #2

Being silly again …

return result is totally different from return $result.

This thread shoud be deleted

Attachments:
xslt_message.png, Symphony_2.2RC3.jpg and xslt_error.png

You’re trying to generate an image using PHP by enabling those PHP-functions in your XSLT?!

You’re trying to generate an image using PHP by enabling those PHP-functions in your XSLT?!

Yes. I’m using EXSL Function Manager :)

Situation is solved.

First. I’m sending the path-to-file from XSL, but I was sending http://localhost/arc/workspace/path-to-file instead of path-to-file, so I was trying to write at http://.... = nonsense.

Second. The registered function returned result instead of $result. Missing $ dollar sign.

Sorry for the harsh words but of the thousand possible ways to solve this, the one you’ve chosen must be the worst. :-)

Using Symphony and XSLT as a wrapper for PHP to generate an image just isn’t right. Can you explain what you’re trying to achieve?

This is taken from the readme of EXSL Function Manager:

Do use this to generate views, or initiate behavior using those views, that would otherwise be awkward or impossible within Symphony.

Look at the script in the attached archive. Open index.php in the browser and voila! Check out the new image created in labels folder :)

www.arc-electronic.ro. This is the site (english version soon). The text labels from the top region of the boxes are generated with this little script. If you want the extension which integrates it, let me know and I’ll post it on github.

Before this I had to manually insert text in index.php, then copy the generated image in the css folder and then target it from .xsl. Pain … Now, all I have to do is this

<xsl:call-template name="image_label">
    <xsl:with-param name="text" select="'Symphony 2.2RC3'" />
    <xsl:with-param name="color" select="'red'" />
</xsl:call-template>

and this template will take care of the rest

<xsl:template name="image_label">
    <xsl:param name="text" />
    <xsl:param name="color" />

    <xsl:variable name="textLowercase">
        <xsl:call-template name="lowercase">
            <xsl:with-param name="value" select="$text" />
        </xsl:call-template>
    </xsl:variable>

    <xsl:variable name="textHandle" select="translate($textLowercase, ' ', '_')" />
    <xsl:variable name="path" select=" concat('/css/images/titluri/', $textHandle, '.jpg')" />
    <xsl:variable name="result" select='arcel:labels($text, $color, $path)' />

    <img style="margin-left:10px;" src="{$workspace}/{$path}" alt="{$text}"/>
</xsl:template>

Painless :)

Attachments:
labels.rar

Sorry for the harsh words but of the thousand possible ways to solve this, the one you’ve chosen must be the worst. :-)

Btw, what other ways do you see to accomplishing this task? I’m eager to integrating new ways to resolving things.

Hi vlad,

You could create an extension that supplies a service similar to the JIT image processing extension. The url could take (as a GET parameter) the text and other arguments. So for instance, your markup would look like:

<img src="your_extension/?text='Symphony 2.2RC3'&color='red'"/>

You'll have to refer to JIT to see how it routes its requests, but I think that would be a simpler solution. You might also run into encoding issues, but probably nothing insurmountable.

@ashooner

ohh, after a few days I finally understood what you are saying. Good point! Will investigate it ...

Update

Today (16.03.2011) I took a deep breath of courage and looked into JIT rerouting. I achieved what ashooner suggested and it works marvelous.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details