Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 4 of 4

Thread: ML 9.3 Showing No Picture instead of Micro Images when using Auto-Resize Option

  1. #1
    stevewest9 is offline Junior Member
    Join Date
    Nov 2012
    Posts
    15

    Default ML 9.3 Showing No Picture instead of Micro Images when using Auto-Resize Option

    There appears to be a bug in the way the files are named with the "micro" option turned on and displaying the "micro" instead of the numbered images.

    When the auto resize is created, the images are uploaded with a trailing "2_1_.jpg" instead of "2_1.jpg" The trailing underscore makes it so that the method LookupProductImage it seeks an image with "2_1.jpg" and not one with the trailing underscore. This leads to the "nopicture.gif" being presented instead of the correct image even though the admin has been used to generate these images.

  2. #2
    GoVedia is offline Member
    Join Date
    Oct 2012
    Location
    Orange, CA
    Posts
    98

    Default trailing underscore

    The trailing underscore is correct. It's not a new occurrence with 9.3
    Robert Kanaan
    AspDotNetStorefront Development Partner
    robert@GoVedia.com
    408-758-8845

    GoVedia
    http://GoVedia.com
    Approved AspDotNetStorefront Development Partner
    AspDotNetStorefront Recommended Reseller

  3. #3
    stevewest9 is offline Junior Member
    Join Date
    Nov 2012
    Posts
    15

    Default

    So is this a known bug?

    The code in the "Micro" assumes no trailing underscore, yet the code that generates these images from the file EntityProductImageMgr.aspx.cs creates a trailing underscore

    Note the code from that file:

    String SafeColor = CommonLogic.MakeSafeFilesystemName(Color);

    bool DeleteIt = (CommonLogic.FormCanBeDangerousContent("Delete_" + TheFieldID.ToString()).Length != 0);
    if (DeleteIt)
    {
    System.IO.File.Delete(AppLogic.GetImagePath("Produ ct", TheSize, true) + FN + "_" + ImageNumber.ToLowerInvariant() + "_" + SafeColor + ".jpg");
    System.IO.File.Delete(AppLogic.GetImagePath("Produ ct", TheSize, true) + FN + "_" + ImageNumber.ToLowerInvariant() + "_" + SafeColor + ".gif");
    System.IO.File.Delete(AppLogic.GetImagePath("Produ ct", TheSize, true) + FN + "_" + ImageNumber.ToLowerInvariant() + "_" + SafeColor + ".png");
    System.IO.File.Delete(AppLogic.GetImagePath("Produ ct", "micro", true) + FN + "_" + ImageNumber.ToLowerInvariant() + ".jpg");

    }


    But the code when retrieving the "Micro" assumes no underscore. This results in the "No Image" always showing even though there is always an image.

  4. #4
    stevewest9 is offline Junior Member
    Join Date
    Nov 2012
    Posts
    15

    Default

    Here is the code in the file ProductImageGallery.cs

    To determine the micro file, you see that no underscore is added to this code:

    ImageLoc = AppLogic.LocateImageURL("images/product/micro/" + m_ProductID.ToString() + "_" + i.ToString() + ".gif");
    if (!CommonLogic.FileExists(ImageLoc))
    ImageLoc = AppLogic.LocateImageURL("images/product/micro/" + m_ProductID.ToString() + "_" + i.ToString() + ".jpg");
    if (!CommonLogic.FileExists(ImageLoc))
    ImageLoc = AppLogic.LocateImageURL("images/product/micro/" + m_ProductID.ToString() + "_" + i.ToString() + ".png");
    if (!CommonLogic.FileExists(ImageLoc))
    ImageLoc = AppLogic.LocateImageURL("App_Themes/skin_" + m_SkinID + "/images/nopicture.gif");


    So basically this yields a result of "nopicture.gif" being shown when you turn on the feature that shows the micro files instead of the numbered icons for multiple files.


    It seems to me that the fix is to simply remove the hard coded trailing underscores from the file upload manager, and the if SafeColor exists, to pre-pend that to the string so that an underscore is added before the SafeColor. That way the images will be consistent as expected.

    I suppose the other fix is to add a trailing underscore to the ProductImageGallery.cs, but that is not as desirable since a trailing underscore is a little bit unnatural for file naming convention.

    Please advise...thanks.