Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
In #ezpublish irc (freenode.net) Bratt shared his solution to use a copy of an ezpublish website from production on a local dev without the var directory images (this is a kernel hack atm but could be transformed into a kernel override)
--- kernel/classes/datatypes/ezimage/ezimagealiashandler.php 2014-07-17 11:18:00.000000000 +0200
+++ kernel/classes/datatypes/ezimage/ezimagealiashandler.php 2014-07-17 11:51:57.000000000 +0200
@@ -551,6 +551,10 @@
}
$this->setOriginalAttributeData( $originalData );
+ $ini = eZINI::instance( 'image.ini' );
+ $imagesRemoteUrl = $ini->variable( 'ImageConverterSettings', 'ImagesRemoteURL' );
+ $imagesRemoteUrl = rtrim( $imagesRemoteUrl, '/' ) . '/';
+
$aliasEntry['name'] = 'original';
$aliasEntry['width'] = $imageNode->getAttribute( 'width' );
$aliasEntry['height'] = $imageNode->getAttribute( 'height' );
@@ -562,7 +566,7 @@
$aliasEntry['alternative_text'] = $alternativeText;
$aliasEntry['text'] = $displayText;
$aliasEntry['original_filename'] = $originalFilename;
- $aliasEntry['url'] = $imageNode->getAttribute( 'url' );
+ $aliasEntry['url'] = $imagesRemoteUrl . $imageNode->getAttribute( 'url' );
$aliasEntry['alias_key'] = $imageNode->getAttribute( 'alias_key' );
$aliasEntry['timestamp'] = $imageNode->getAttribute( 'timestamp' );
$aliasEntry['full_path'] = $aliasEntry['url'];
@@ -610,7 +614,7 @@
$aliasEntry['alias_key'] = $imageVariation->getAttribute( 'alias_key' );
$aliasEntry['timestamp'] = $imageVariation->getAttribute( 'timestamp' );
$aliasEntry['is_valid'] = $imageVariation->getAttribute( 'is_valid' );
- $aliasEntry['url'] = $imageVariation->getAttribute( 'url' );
+ $aliasEntry['url'] = $imagesRemoteUrl . $imageVariation->getAttribute( 'url' );
$aliasEntry['basename'] = $basename;
$aliasEntry['alternative_text'] = $alternativeText;
$aliasEntry['text'] = $displayText;
--- lib/ezimage/classes/ezimagemanager.php 2014-07-17 11:30:50.000000000 +0200
+++ lib/ezimage/classes/ezimagemanager.php 2014-07-17 11:30:57.000000000 +0200
@@ -250,6 +250,7 @@
*/
function isImageAliasValid( $alias )
{
+ return true;
$aliasName = $alias['name'];
if ( isset( $this->AliasList[$aliasName] ) )
{
@@ -783,6 +784,7 @@
*/
function createImageAlias( $aliasName, &$existingAliasList, $parameters = array() )
{
+ return true;
$fname = "createImageAlias( $aliasName )";
// check for $aliasName validity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.