Topic: Multiple images all scrunched up when moving database

Hi everyone,

Hoping someone can please help me with this.

I have just moved our entire site to a different domain and server. Everything is working fine except for the autoviewer shows up images all bunched together.

We have hundreds of products in a php filter and using auotviewer to display 3 x images of each product when showing exact products.

Unfortunately I do not have the original autoviewer file my developer used and only have the SWF on the server.

Has this happened to anyone or does anyone have any ideas on how to solve this?

I can show snippets of code if anyone wants to have a look.

Appreciate any help given!

I have uploaded a screenshot if that helps? smile

http://indoorplaygroundequipment.com.au/autoviewer.jpg

Re: Multiple images all scrunched up when moving database

I would suggest re-uploading your galleries files (the SWF file and the images) to ensure that all files are present and correct.
If you do not have access to a fresh copy of the AutoViewer SWF file, then you could at least try re-uploading the images to see if this helps (in case the images have somehow become corrupt in the move).
If this does not help, then please post the URL to your gallery so that I can take a look and help further.

Steven Speirs
SimpleViewer Support Team.

Re: Multiple images all scrunched up when moving database

Thanks for the support Steven...

I re-uploaded everything but not joy.

Apologies, I must have the pro version not the free version as I just uploaded a fresh autoviewer.swf from your site and that made no difference at all but noticed it had your little logo on there so we must have the pro.

The link to the gallery is here: http://www.indoorplaygroundequipment.co … rounds.php

My developer has heavily modified your original code though so if there is more than one image it will use autoviewer to display the multiplr images as shown below...

<?PHP if(count($imgs) > 1) { ?>
            <script type="text/javascript">
                var fo = new SWFObject("assets/flash/autoviewer.swf", "autoviewer", "100%", "384", "8", "#ffffff");                       
                //Optional Configuration
                //fo.addVariable("langOpenImage", "Open Image in New Window");
                //fo.addVariable("langAbout", "About");   
                fo.addVariable("playAtStart", "true");   
                fo.addVariable("enableImageUpScaling", "true");   
                fo.addVariable("unselectedBrightness", "120");
                fo.addParam("wmode", "transparent");
                fo.addVariable("xmlURL", "db_getGalleryXML.php?code=<?PHP echo $_REQUEST['code'] ?>");                   
                fo.write("flashcontent");           
            </script>
        <?PHP } ?>


****************Below is the db_getGalleryXML.php code if that helps at all?

<?PHP

    require("assets/db/db_include.php");

    $designInfo = db_getDesignInfo($_REQUEST['code']);

    $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><gallery></gallery>');
   
    //$t_gallery = $xml->gallery[0];
    $xml->addAttribute('frameColor', '0xFFFFFF');
    $xml->addAttribute('frameWidth', '0');
    $xml->addAttribute('imagePadding', '20');
    $xml->addAttribute('displayTime', '6');
    $xml->addAttribute('enableRightClickOpen', 'true');
   
    $images = explode(',', $designInfo['ImageUrl']);
   
    foreach($images as $imgNum=>$image) {
        $imgWidths = explode(",", $designInfo['ImageWidths']);
        $imgHeights = explode(",", $designInfo['ImageHeights']);
        if(strlen($image) > 0) {
            if($GLOBALS['isAustralianSite']) {
                $localServer = "/home/inin1056/public_html/";   
                $server = "http://www.indoorplaygroundequipment.com.au/";
            } else {
                $localServer = "/home/inin1056/public_html/";   
                $server = "http://www.indoorplaygroundequipment.com.au/";
            }
           
            //$imgInfo = getimagesize($localServer.'uploads/'.$image);
            //$imgInfo = array(640,480);
            $imgInfo = array($imgWidths[$imgNum], $imgHeights[$imgNum]);
            //$imgInfo = array($designInfo['ImageWidths'][$imgNum], $designInfo['ImageHeights'][$imgNum]);
            if ($imgInfo[0] > $imgInfo[1]) {
                $percentage = (512 / $imgInfo[0]);
            } else {
                $percentage = (384 / $imgInfo[1]);
            }
           
            $width = round($imgInfo[0] * $percentage);
            $height = round($imgInfo[1] * $percentage);
           
            $t_image = $xml->addChild('image', '');
            $t_image->addChild('url', /*$server.*/'uploads/' . $image);
            $t_image->addChild('caption', "<a href='preview/enlargedImage.php?w=".$imgInfo[0]."&h=".$imgInfo[1]."&id=".$_REQUEST['code']."&amp;pic=../uploads/$image'>                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                                                                                    

                                                                                                            </a>");
            $t_image->addChild('width', $width);
            $t_image->addChild('height', $height);
        }
    }
   
    echo $xml->asXML();
?>

Re: Multiple images all scrunched up when moving database

Thank you for the URL to your galleries.
It looks like the problem may be with the PHP file which is generating your XML code.
If you have moved server, then perhaps there is a different version of PHP installed which is parsing your PHP code differently than on your old server.
(The images themselves and the SWF file all look to be OK.)
First of all, try adding the following to the top of your PHP file to inform browsers that the code generated will be XML.

header('Content-type: application/xml');

Also, two of the & characters within your captions should be escaped to &amp;. Otherwise, you could enclose your caption content within CDATA tags.
To determine whether or not the captions are the cause of the problem, try temporarily removing the following line to see if this makes a difference.

$t_image->addChild('caption', "<a href='preview/enlargedImage.php?w=".$imgInfo[0]."&h=".$imgInfo[1]."&id=".$_REQUEST['code']."&amp;pic=../uploads/$image'>                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                                                                                    

                                                                                                            </a>");

(All the whitespace before the closing </a> can be removed.)
Hopefully this will help.

Steven Speirs
SimpleViewer Support Team.

Re: Multiple images all scrunched up when moving database

Thank you again for your help Steven.

I added the below code to the header of the db_getGalleryXML.php file

header('Content-type: application/xml');

This did not change anything.

I removed all of the space before the closing </a> but this did not change anything.

However, I temporary removed the entire code below (my reference line 48) and this did change the images from srunched up to stretched out so you are on to something.

$t_image->addChild('caption', "<a href='preview/enlargedImage.php?w=".$imgInfo[0]."&h=".$imgInfo[1]."&id=".$_REQUEST['code']."&amp;pic=../uploads/$image'></a>");

I have left the code removed so you can have a look at the site, direct link below for a product.

http://www.indoorplaygroundequipment.co … de=4651009

So my getgallery code looks like this...

<?PHP


header('Content-type: application/xml');

    require("assets/db/db_include.php");

    $designInfo = db_getDesignInfo($_REQUEST['code']);

    $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><gallery></gallery>');
   
    //$t_gallery = $xml->gallery[0];
    $xml->addAttribute('frameColor', '0xFFFFFF');
    $xml->addAttribute('frameWidth', '0');
    $xml->addAttribute('imagePadding', '20');
    $xml->addAttribute('displayTime', '6');
    $xml->addAttribute('enableRightClickOpen', 'true');
   
    $images = explode(',', $designInfo['ImageUrl']);
   
    foreach($images as $imgNum=>$image) {
        $imgWidths = explode(",", $designInfo['ImageWidths']);
        $imgHeights = explode(",", $designInfo['ImageHeights']);
        if(strlen($image) > 0) {
            if($GLOBALS['isAustralianSite']) {
                $localServer = "/home/inin1056/public_html/";   
                $server = "http://www.indoorplaygroundequipment.com.au/";
            } else {
                $localServer = "/home/inin1056/public_html/";   
                $server = "http://www.indoorplaygroundequipment.com.au/";
            }
           
            //$imgInfo = getimagesize($localServer.'uploads/'.$image);
            //$imgInfo = array(640,480);
            $imgInfo = array($imgWidths[$imgNum], $imgHeights[$imgNum]);
            //$imgInfo = array($designInfo['ImageWidths'][$imgNum], $designInfo['ImageHeights'][$imgNum]);
            if ($imgInfo[0] > $imgInfo[1]) {
                $percentage = (512 / $imgInfo[0]);
            } else {
                $percentage = (384 / $imgInfo[1]);
            }
           
            $width = round($imgInfo[0] * $percentage);
            $height = round($imgInfo[1] * $percentage);
           
            $t_image = $xml->addChild('image', '');
            $t_image->addChild('url', /*$server.*/'uploads/' . $image);
            $t_image->addChild('caption', "<a href='preview/enlargedImage.php?w=".$imgInfo[0]."&h=".$imgInfo[1]."&id=".$_REQUEST['code']."&amp;pic=../uploads/$image'></a>");
            $t_image->addChild('width', $width);
            $t_image->addChild('height', $height);
        }
    }
   
    echo $xml->asXML();
?>

Re: Multiple images all scrunched up when moving database

Hi Steven,

Appreciate your help with this,

I decided to put that line back with the fix up's you mentioned above so the code now looks like this...

<?PHP

header('Content-type: application/xml');

    require("assets/db/db_include.php");

    $designInfo = db_getDesignInfo($_REQUEST['code']);

    $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><gallery></gallery>');
   
    //$t_gallery = $xml->gallery[0];
    $xml->addAttribute('frameColor', '0xFFFFFF');
    $xml->addAttribute('frameWidth', '0');
    $xml->addAttribute('imagePadding', '20');
    $xml->addAttribute('displayTime', '6');
    $xml->addAttribute('enableRightClickOpen', 'true');
   
    $images = explode(',', $designInfo['ImageUrl']);
   
    foreach($images as $imgNum=>$image) {
        $imgWidths = explode(",", $designInfo['ImageWidths']);
        $imgHeights = explode(",", $designInfo['ImageHeights']);
        if(strlen($image) > 0) {
            if($GLOBALS['isAustralianSite']) {
                $localServer = "/home/inin1056/public_html/";   
                $server = "http://www.indoorplaygroundequipment.com.au/";
            }
           
            //$imgInfo = getimagesize($localServer.'uploads/'.$image);
            //$imgInfo = array(640,480);
            $imgInfo = array($imgWidths[$imgNum], $imgHeights[$imgNum]);
            //$imgInfo = array($designInfo['ImageWidths'][$imgNum], $designInfo['ImageHeights'][$imgNum]);
            if ($imgInfo[0] > $imgInfo[1]) {
                $percentage = (512 / $imgInfo[0]);
            } else {
                $percentage = (384 / $imgInfo[1]);
            }
           
            $width = round($imgInfo[0] * $percentage);
            $height = round($imgInfo[1] * $percentage);
           
            $t_image = $xml->addChild('image', '');
            $t_image->addChild('url', /*$server.*/'uploads/' . $image);
            $t_image->addChild('caption', "<a href='preview/enlargedImage.php?w=".$imgInfo[0]."&amp;h=".$imgInfo[1]."&amp;id=".$_REQUEST['code']."&amp;pic=../uploads/$image'></a>");
            $t_image->addChild('width', $width);
            $t_image->addChild('height', $height);
        }
    }
   
    echo $xml->asXML();
?>

Re: Multiple images all scrunched up when moving database

Just in case this may help too...


Old server details that is working 100%

Database server

    Server: Localhost via UNIX socket
    Server type: MySQL
    Server version: 5.1.73-cll - MySQL Community Server (GPLv2)
    Protocol version: 10
    User: USER
    Server charset: UTF-8 Unicode (utf8)

Web server

    cpsrvd 11.42.1.5
    Database client version: libmysql - 5.0.96
    PHP extension: mysqli Documentation

phpMyAdmin

    Version information: 4.1.8, latest stable version: 4.1.13


NEW SERVER DETAILS

Database server

    Server: Localhost via UNIX socket
    Server type: MySQL
    Server version: 5.5.36-cll - MySQL Community Server (GPL)
    Protocol version: 10
    User: USER
    Server charset: UTF-8 Unicode (utf8)

Web server

    cpsrvd 11.42.1.5
    Database client version: libmysql - 5.0.96
    PHP extension: mysqli Documentation

phpMyAdmin

    Version information: 4.1.8, latest stable version: 4.1.13

Re: Multiple images all scrunched up when moving database

I did not notice this before but looking at your dynamically-generated XML file, many of your images have very small values for the <width> tags.
For example your first image has <width>0</width> and your second image has <width>120</width> so it looks like the problem is with your PHP file's method for determining the widths of your images.
Please check the code that defines the $width variable in your PHP file.

Steven Speirs
SimpleViewer Support Team.

Re: Multiple images all scrunched up when moving database

Sorry for not getting back to you earlier...

I tried all different types of changes and nothing worked.

But....I noticed if I re-upload the images using the php upload script that the developer created they work fine so I have just spent the last few hours re-uploading everything so happy days!

Thank you for your help though, greatly appreciated!


Andy6265 wrote:

Just in case this may help too...


Old server details that is working 100%

Database server

    Server: Localhost via UNIX socket
    Server type: MySQL
    Server version: 5.1.73-cll - MySQL Community Server (GPLv2)
    Protocol version: 10
    User: USER
    Server charset: UTF-8 Unicode (utf8)

Web server

    cpsrvd 11.42.1.5
    Database client version: libmysql - 5.0.96
    PHP extension: mysqli Documentation

phpMyAdmin

    Version information: 4.1.8, latest stable version: 4.1.13


NEW SERVER DETAILS

Database server

    Server: Localhost via UNIX socket
    Server type: MySQL
    Server version: 5.5.36-cll - MySQL Community Server (GPL)
    Protocol version: 10
    User: USER
    Server charset: UTF-8 Unicode (utf8)

Web server

    cpsrvd 11.42.1.5
    Database client version: libmysql - 5.0.96
    PHP extension: mysqli Documentation

phpMyAdmin

    Version information: 4.1.8, latest stable version: 4.1.13

Re: Multiple images all scrunched up when moving database

I am glad that you have been able to resolve your problem.
Thank you for posting back to let me know.

Steven Speirs
SimpleViewer Support Team.