Announcement

Collapse
No announcement yet.

Advanced Guide Article Update - Auto Sized Product Images

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

    #31
    Norman

    Having first made a new folder within my site 1 folder, named Thumbnails, I created the new variable SectionImageScaledWidth and used instead of ProductImageScaledWidth.

    I have also replaced all references to ProductName with SectionName.

    Nothing happens at all.

    I think this thread has become confused by having a number of parties intervene with their respective suggestions. MNight I suggest someone (perhaps from Actinic) provide a straight forward easy to follow guide as to how thumbnails can be created from large images?

    Thanks
    Richard Hodgson
    Fantasy
    www.whatsyourfantasy.co.uk

    Comment


      #32
      As I stated earlier in this thread, it isn't a novices patch.

      Use either my original post (#1) or the Advanced Guide.

      If you want to adapt it to do something different to its original purpose, then you'll need a thorough understanding of how it works.

      It's unlikely that Actinic can help here as they didn't write it.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #33
        What would force the new generation of the resized images? The thumbs were generated on the first trial upload and work as expected. Just done another upload and all the t_images.jpg are being sent .... the Thumbs folder shows the time and date when the upload procedure was started the second time.

        The product layout has been changed but not the ProductImage layout, resize script, width variable etc so wondered what would force the generation of all the thumbs again (2983 is no fun)


        Bikster
        SellerDeck Designs and Responsive Themes

        Comment


          #34
          Originally posted by ki450751 View Post
          Hi I have followed your instructions and not Norman's. Have I missed anything in your instructions?

          When in the design tab I receive the following error messages (see attached file).

          Please advise.

          Thanks

          Richard
          Hi Richard,

          Sorry its been a long time since I did this - I used Normans code for products then tweaked for sections so it should all work ok based on what I pasted in my post. Your errors refer to the product setup not the section setup so not sure whether you are using the variables in the right place or they are set up properly.

          As mentioned before this isnt a simple setup process - probably best to check through all the steps again to make sure you did everything 'by the book'?
          seo company: web development - online marketing - actinic ecommerce

          Comment


            #35
            Originally posted by jont View Post
            What would force the new generation of the resized images?
            I sorted this here http://community.actinic.com/showthread.php?p=235848 if of use to anyone.


            Bikster
            SellerDeck Designs and Responsive Themes

            Comment


              #36
              Not working - path structure?

              Hi Folks,

              I couldn't get this to work, is it to do with my file structure?

              I have a multi-user so mine goes Actinic v8/Sites/Serenity Sounds/Thumbnails and the picture files are placed there. I am not sure what I need to change in the layout script?

              Thanks.
              Nigel Singer
              www.lifetools.com
              Solutions for Life

              Comment


                #37
                The paths are relative

                $sThumbImageName = 'Thumbnails/

                so long as you manually create the "Thumbnails" folder in each of your site folders the paths should work. What errors are you getting?


                Bikster
                SellerDeck Designs and Responsive Themes

                Comment


                  #38
                  Well I assume this script will have replaced all of my images with the t_ prefix however no images have been touched. I assume the earlier line of replace // with \ deals with the different slashes from windows of \ to the scripting of Thumbnails/

                  So I am at a loss as to why it isn't affecting the picture files.
                  Nigel Singer
                  www.lifetools.com
                  Solutions for Life

                  Comment


                    #39
                    Assuming you have it installed correctly it will take the product image reference by each product and generate a thumbnail version "t_Filename.jpg" and place in the "Thumbnails" folder... the original product image remains intact.

                    You will need to force the script to run ... try clicking around a few sections and check the Thumbnails folder ... it should be populated by the t_Filename images for the products in the sections you have viewed... this is done automatically when you upload and Actinic checks the sections.


                    Bikster
                    SellerDeck Designs and Responsive Themes

                    Comment


                      #40
                      hi

                      has anyone had this not generating the thumbnails? ive been trying all night to get this going and havent got past my Thumbnails folder remaining empty after Publish to Web

                      tia

                      Comment


                        #41
                        The patch works on Preview as well so you don't need to upload. Preview a page and look in the page source for error messages.
                        Norman - www.drillpine.biz
                        Edinburgh, U K / Bitez, Turkey

                        Comment


                          #42
                          cheers, time pressure has meant ive put this on the backburner, but i'll try again soon and post my results

                          Comment


                            #43
                            Edited Message..

                            Section resized images

                            I left this last night in a mess and came back this morning to make it semi-work.

                            I've altered the references in the code from t_ to s_

                            I am now producing the thumbnails in the temp folder and they are appearing in Page preview re-sized.
                            But I just get 'Thumbnail creation error opening: UC101.jpg' on the live site.

                            any suggestions?


                            Code:
                            <actinic:block php="true" >
                            		// START Create a thumbnail image s_SectionImageFileName
                            		$sOriginalImageName = str_replace('../','', '<actinic:variable name="SectionImageFileName" encoding="perl" selectable="false" />');
                            		$nScaledWidth = <actinic:variable name="SectionImageScaledWidth" encoding="perl" selectable="false" />;
                            		$sThumbImageName = 'Thumbnails/s_' . 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);
                            			$s_width = $nScaledWidth;
                            			$s_height = round($height * ($s_width / $width));
                            			// Resample
                            			$thumbimage = imagecreatetruecolor($s_width, $s_height);
                            			imagecopyresampled($thumbimage, $image, 0, 0, 0, 0, $s_width, $s_height, $width, $height);
                            			if ( ! imagejpeg($thumbimage, $sThumbImageName) ) 
                            				{
                            				echo "<font color=red>Thumbnail image creation failed: $sThumbImageName </font><br>";
                            				}
                            			else
                            				{
                            				echo "<img src=\"$sThumbImageName\" width=\"$s_width\" height=\"$s_height\" border=\"0\"";
                            				echo " alt=\"<actinic:variable name="SectionName" encoding="strip"/>\" />";
                            				}	
                            			}
                             	// END Create a thumbnail image s_SectionImageFileName
                             	</actinic:block>  
                            
                            </actinic:block>
                            Clothing to make an impression.
                            www.stitchfactory.co.uk

                            Comment


                              #44
                              This appears to be someone elses interpretation of my original post. I don't see why they've done this line
                              Code:
                              		$sOriginalImageName = str_replace('../','', '<actinic:variable name="SectionImageFileName" encoding="perl" selectable="false" />');
                              Try using
                              Code:
                              		$sOriginalImageName = str_replace('\\','/', '<actinic:variable name="SectionImageFileName" encoding="perl" selectable="false" />');
                              Norman - www.drillpine.biz
                              Edinburgh, U K / Bitez, Turkey

                              Comment


                                #45
                                Thanks Norm but it's still not happening.

                                I started again with your code changing the Variables to Section but now I don't get the s_images being created.
                                I've backtracked a few times but all I can see is the block if below could be causing an issue.

                                Code:
                                <actinic:block if="%3cactinic%3avariable%20name%3d%22IsProductImageDisplayed%22%20%2f%3e" >
                                The full Code is below

                                Code:
                                <div class="product_list">
                                			<div class="image_product"><a href="<actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20AND%0d%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e" ><actinic:variable name="SectionPageName" /></actinic:block><actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20%3d%3d%20false%29%20OR%0d%28%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e%20%3d%3d%20false%29" ><actinic:variable name="SectionURL" /></actinic:block>" target="_self">
                                		
                                <actinic:block if="%3cactinic%3avariable%20name%3d%22IsProductImageDisplayed%22%20%2f%3e" >
                                	<actinic:block php="true" >
                                		// START Create a thumbnail image s_SectionImageFileName
                                		$sOriginalImageName = str_replace('\\','/', '<actinic:variable encoding="perl" name="SectionImageFileName" selectable="false" />');
                                		$nScaledWidth = <actinic:variable encoding="perl" name="SectionImageScaledWidth" selectable="false" />;
                                		$sThumbImageName = 'Thumbnails/s_' . 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);
                                			$s_width = $nScaledWidth;
                                			$s_height = round($height * ($s_width / $width));
                                			// Resample
                                			$thumbimage = imagecreatetruecolor($s_width, $s_height);
                                			imagecopyresampled($thumbimage, $image, 0, 0, 0, 0, $s_width, $s_height, $width, $height);
                                			if ( ! imagejpeg($thumbimage, $sThumbImageName) ) 
                                				{
                                				echo "<font color=red>Thumbnail image creation failed: $sThumbImageName </font><br>";
                                				}
                                			else
                                				{
                                				echo "<img src=\"$sThumbImageName\" width=\"$s_width\" height=\"$s_height\" border=\"0\"";
                                				echo " alt=\"<actinic:variable name="SectionName" encoding="strip"/>\" />";
                                				}	
                                			}
                                 	// END Create a thumbnail image s_SectionImageFileName
                                 	</actinic:block>  
                                
                                </actinic:block>
                                
                                </actinic:block>
                                
                                	<div><h3 class="product"><a href="<actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20AND%0d%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e" ><actinic:variable name="SectionPageName" /></actinic:block><actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20%3d%3d%20false%29%20OR%0d%28%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e%20%3d%3d%20false%29" ><actinic:variable name="SectionURL" /></actinic:block>" target="_self"><actinic:variable name="SectionName" /></a></h3></div>
                                			<p><actinic:variable encoding="actinic" name="SectionDescription" if="false" /></p>
                                		</div>
                                Clothing to make an impression.
                                www.stitchfactory.co.uk

                                Comment

                                Working...
                                X