Announcement

Collapse
No announcement yet.

image resize - creation error using extendedinfoimage

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    image resize - creation error using extendedinfoimage

    Hi All,
    Hope someone can help.

    Could someone look at the code below and tell me if there is a reason I get "thumbnail creation error opeing:../imagefilename.jpg in the preview (and the thumbnail no longer gets produced obviously).

    <p><actinic:block if="%3cactinic%3avariable%20name%3d%22IsPopUpDisplayedByImage%22%20%2f%3e" >
    <a href="<actinic:variable name="ExtendedInfoImage" />" rel="images" title="<actinic:variable name="ProductName" />">
    </actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsExtendedImageSpecified%22%20%2f%3e" >
    <actinic:block php="true" >
    // START Create a thumbnail image t_ProductImageFileName
    $sOriginalImageName = str_replace('\\','/', '<actinic:variable encoding="perl" name="ExtendedInfoImage" selectable="false" />');
    $nScaledWidth = <actinic:variable encoding="perl" name="ProductImageScaledWidth" selectable="false" />;
    $sThumbImageName = 'thumbnails/t_' . basename($sOriginalImageName);
    $image = @imagecreatefromjpeg($sOriginalImageName); /* Attempt to open */
    if (!$image)
    { /* See if it failed */
    echo "<br><font color=red>Thumbnail creation error opening: $sOriginalImageName </font>";
    }
    else
    {
    // Get new dimensions
    $width = imagesx($image);
    $height = imagesy($image);
    $t_width = $nScaledWidth;
    $t_height = round($height * ($t_width / $width));
    // Resample
    $thumbimage = imagecreatetruecolor($t_width, $t_height);
    imagecopyresampled($thumbimage, $image, 0, 0, 0, 0, $t_width, $t_height, $width, $height);
    if ( ! imagejpeg($thumbimage, $sThumbImageName) )
    {
    echo "<font color=red>Thumbnail image creation failed: $sThumbImageName </font><br>";
    }
    else
    {
    echo "<img src=\"$sThumbImageName\" width=\"$t_width\" height=\"$t_height\" border=\"0\"";
    echo " alt=\"<actinic:variable name="ProductName" encoding="strip"/>\" />";
    }
    }
    // END Create a thumbnail image t_ProductImageFileName
    </actinic:block>
    </actinic:block>

    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsExtendedImageSpecified%22%20%2f%3e%20%3d%3d%20False" >
    <img src="<actinic:variable name="DefaultProductImage" />"
    border="0"
    alt="<actinic:variable name="ProductName" encoding="strip"/>" />
    </actinic:block>

    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsPopUpDisplayedByImage%22%20%2f%3e" >
    <span class="zoom"></span></a>
    </actinic:block>
    </p>
    I am using a single product page (SSP) layout using the extended info method.

    Had everything working fine including image resizing from ProductImageFileName but a request from the client meant that the product list needed to use a differnt image though the image on the SPP could still generate from a larger image that gets used in a lightbox when user clicks to enlarge.

    To accomodate this i felt it more understandable for the client that the file requested in the product image field would be used for the product list and that I could use the extended info image field to use for the lightbox image and the generate "thumbnail" which would be used for the main product image on the SPP.

    Any help appreciated,
    Cheers

    Lee
    Boxhedge New Media Design
    Design and development solutions for SME's.
    Tel: 0118 966 2786
    Examples of work can be found at http://www.boxhedge.com

    #2
    I don't know if this would help anyone solve my problem but in the preview html it says:

    Thumbnail creation error opening: ../Yoyos_Sgcy.jpg

    Yoyos_Sgcy.jpg being an image I am trying to resize but I thought the ../ was interesting in that the image is in the root directory unless it is trying to work well by pointing to the image from within the Previewhtml directory, in which case it is even more confusing.

    p.s Alos worth noting that the enlarged or original image as it were is still ouputting perfectly so it is only the thumbnail which is the problem
    Last edited by bangers; 23-Oct-2009, 09:27 AM. Reason: more info
    Boxhedge New Media Design
    Design and development solutions for SME's.
    Tel: 0118 966 2786
    Examples of work can be found at http://www.boxhedge.com

    Comment


      #3
      If you get no answers, maybe worth looking at the free code Norman provided to do the resizing of images. If you can't use it, you might get some pointers possibly.

      Comment


        #4
        cheers lee but i started with that and still had the problems so i then found the above created by jont: http://community.actinic.com/showthr...t+image+resize


        So in short i've already gone around the houses and tried a number of things but maybe worth going back again to the version in the AUG and start again but I have tried and it didn't work last time.

        I know I must be missing something obvious
        Boxhedge New Media Design
        Design and development solutions for SME's.
        Tel: 0118 966 2786
        Examples of work can be found at http://www.boxhedge.com

        Comment


          #5
          ah ok, bugger. Sounds on the surface to me it's the image location that's the problem. Actinic does some funny things in this area. I've never had Greybox work in actinic on preview, but perfectly fine online as an example.

          Comment


            #6
            To confirm i just change to this:

            <p>
            <actinic:block if="%3cactinic%3avariable%20name%3d%22IsPopUpDisplayedByImage%22%20%2f%3e" >
            <actinic:block if="%3cactinic%3avariable%20name%3d%22IsExtendedImageSpecified%22%20%2f%3e" >
            <a href="<actinic:variable name="ExtendedInfoImage" />" rel="images" title="<actinic:variable name="ProductName" />">
            </actinic:block>
            </actinic:block>

            <actinic:block if="%3cactinic%3avariable%20name%3d%22IsExtendedImageSpecified%22%20%2f%3e" >
            <actinic:block php="true" >
            // START Create a thumbnail image t_ProductImageFileName
            $sOriginalImageName = str_replace('\\','/', '<actinic:variable encoding="perl" name="ExtendedInfoImage" selectable="false" />');
            $nScaledWidth = <actinic:variable name="ProductImageScaledWidth" encoding="perl" selectable="false" />;
            $sThumbImageName = 'woodentoys/p_' . basename($sOriginalImageName);
            $image = @imagecreatefromjpeg($sOriginalImageName); /* Attempt to open */
            if (!$image)
            { /* See if it failed */
            echo "<br><font color=red>Thumbnail creation error opening: $sOriginalImageName </font>";
            }
            else
            {
            // Get new dimensions
            $width = imagesx($image);
            $height = imagesy($image);
            $t_width = $nScaledWidth;
            $t_height = round($height * ($t_width / $width));
            // Resample
            $thumbimage = imagecreatetruecolor($t_width, $t_height);
            imagecopyresampled($thumbimage, $image, 0, 0, 0, 0, $t_width, $t_height, $width, $height);
            if ( ! imagejpeg($thumbimage, $sThumbImageName) )
            {
            echo "<font color=red>Thumbnail image creation failed: $sThumbImageName </font><br>";
            }
            else
            {
            echo "<img src=\"$sThumbImageName\" width=\"$t_width\" height=\"$t_height\" border=\"0\"";
            echo " alt=\"<actinic:variable name="ProductName" encoding="strip"/>\" />";
            }
            }
            // END Create a thumbnail image t_ProductImageFileName
            </actinic:block>

            </actinic:block>

            <actinic:block if="%3cactinic%3avariable%20name%3d%22IsExtendedImageSpecified%22%20%2f%3e%20%3d%3d%20False" >
            <img src="<actinic:variable name="DefaultProductImage" />"
            border="0"
            alt="<actinic:variable name="ProductName" encoding="strip"/>" />
            </actinic:block>

            <actinic:block if="%3cactinic%3avariable%20name%3d%22IsPopUpDisplayedByImage%22%20%2f%3e" >
            <actinic:block if="%3cactinic%3avariable%20name%3d%22IsExtendedImageSpecified%22%20%2f%3e" >
            <span class="zoom"></span></a>
            </actinic:block>
            </actinic:block>
            </p>
            and still the same problem
            Boxhedge New Media Design
            Design and development solutions for SME's.
            Tel: 0118 966 2786
            Examples of work can be found at http://www.boxhedge.com

            Comment


              #7
              Really wierd beause I even have all the images in the root of the site folder to help actinic along.
              Boxhedge New Media Design
              Design and development solutions for SME's.
              Tel: 0118 966 2786
              Examples of work can be found at http://www.boxhedge.com

              Comment


                #8
                Another thought: i had the resize working before with the product image being pulled in but it was orignally on a standard product page not an extended info page. it could be it stopped working at this stage but becuase the thumbnail had already been created I didn't spot it.

                If this is the case can anyone think what Iit could be that I am missing?
                Boxhedge New Media Design
                Design and development solutions for SME's.
                Tel: 0118 966 2786
                Examples of work can be found at http://www.boxhedge.com

                Comment


                  #9
                  You're the victim of an Actinic quirk. Extended Info Images that are outwith the Site folder are inexplicably handled differently from Product ones. You typically get codes that work on preview but error on website upload. Or vice-versa.

                  I would have thought that keeping your Extended Info images in the Site folder would work but you seem to think different.

                  In my paid for add-ons, I suggest keeping Extended Info Images in the same place as Product ones. Then I have to use quite a bit of code that extracts the path of the Product image and prepends it to the basename of the Extended Info one, resulting in a reliable filepath/name combination.
                  Norman - www.drillpine.biz
                  Edinburgh, U K / Bitez, Turkey

                  Comment


                    #10
                    I take your point Norman I will give it a go when I have calmed down.

                    Cheers Norman and Lee,

                    Deep breath.....I could take a boxed version of actinic pick one of its developers and force it into a very dark place.

                    There was nothing wrong with the code, though the preview showed thumbnail error, when I uploaded there was the image on every page!!!!

                    I hadn't uploaded because I thought it would freak out the client to show them the problem. The I came clean so they new I'd been working on it, uploaded and there they were in full technicolor.

                    Just another days head scratching and another day I haven't earned a penny added to the actinic hill of problems that hides a mountain of pain.

                    Thanks again all,
                    Lee
                    Boxhedge New Media Design
                    Design and development solutions for SME's.
                    Tel: 0118 966 2786
                    Examples of work can be found at http://www.boxhedge.com

                    Comment


                      #11
                      Try this:

                      A) Keep all Extended Info images in your Site folder. Then use code like this:
                      Code:
                      $sOriginalImageName  = basename('<actinic:variable name="ExtendedInfoImage" encoding="perl" selectable="false" />');
                      B) Keep all Extended Info images in a folder Images off your Site folder. Then use:
                      Code:
                      $sOriginalImageName  = 'Images/' . basename('<actinic:variable name="ExtendedInfoImage" encoding="perl" selectable="false" />');
                      Both of these (untested) should work on live pages and Preview.
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment


                        #12
                        Cheer Norman, a great help as usual.

                        Now I have to work out why my custom popups (for ssi) aren't generating but that's another thread possibly
                        Boxhedge New Media Design
                        Design and development solutions for SME's.
                        Tel: 0118 966 2786
                        Examples of work can be found at http://www.boxhedge.com

                        Comment

                        Working...
                        X