Page 1 of 2 12 LastLast
Results 1 to 10 of 27

Hybrid View

  1. #1

    Default Re: Adding text to additional images individually

    Thank you so much for your response.

    I am now having more luck with adding the titles to the images. I was previously working with images that have long file names with spaces in the file names. I tried it with images without any spaces in filenames and it worked!!

    I am so excited to have this capability - thank you so much for all your time!

    I will have to change the filenames I suppose. Unless you have another suggestion.

    Thank you again! You have been very helpful!!

    For your reference, below is a link to a page with images that didn't work with adding the titles:
    http://www.palomapottery.com/catalog...products_id=59

    Other pages with images that are working with adding the titles:
    http://www.palomapottery.com/catalog/index.php?main_page=product_info&cPath=16&products_id=18

  2. #2
    Join Date
    Dec 2008
    Location
    San Fran
    Posts
    382
    Plugin Contributions
    0

    Default Re: Adding text to additional images individually

    I just noticed another problem... when putting the path in the language file for an image that's in a folder, it isn't working.

    My image path in zencart is in images/bulk/bulk10_curly.jpg

    I put:
    define ('ADDIMG_BULK_BULK10_CURLY_JPG','curly');

    But it doesn't bring up any text at all.

    Images in the root image folder seem to work just fine, any ideas?

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adding text to additional images individually

    Just because Microsoft lets users make file/folder names with spaces doesn't mean it's a good idea...
    It is a universal computer best practice to use only letters, numbers, _, -, . and perhaps one or two other characters in filenames. Keeping letters lower case is also a good idea, as some applications are case sensitive and forgetting what you capitalized can cause unexpected problems.

    Hmm, I'll have to investigate that. I thought it would work with subfolders, but wasn't certain. It will require some detailed debugging to see exactly how the file/folder names are handled.
    Last edited by gjh42; 11 Jan 2009 at 08:34 PM.

  4. #4
    Join Date
    Dec 2008
    Location
    San Fran
    Posts
    382
    Plugin Contributions
    0

    Default Re: Adding text to additional images individually

    Ok I agree with all that, but is there something wrong with the way I have it set up? I'm not using any funny characters at all.

  5. #5
    Join Date
    Dec 2008
    Location
    San Fran
    Posts
    382
    Plugin Contributions
    0

    Default Re: Adding text to additional images individually

    Quote Originally Posted by gjh42 View Post
    Just because Microsoft lets users make file/folder names with spaces doesn't mean it's a good idea...
    It is a universal computer best practice to use only letters, numbers, _, -, . and perhaps one or two other characters in filenames. Keeping letters lower case is also a good idea, as some applications are case sensitive and forgetting what you capitalized can cause unexpected problems.

    Hmm, I'll have to investigate that. I thought it would work with subfolders, but wasn't certain. It will require some detailed debugging to see exactly how the file/folder names are handled.
    Sorry I didn't see your part about the "DEBUGGING" thing... sorry about that. That's no problem, I undestand. I'll just stick with them in the root folder for now.

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adding text to additional images individually

    The $file variable holds the filename only; $base_image has the subfolder (if any) plus filename.This code will handle any file (as long as it doesn't have spaces), and put the text above or below the image (depending on the value of a constant ADDIMG_TEXT_TOP which should be set in the definitions file):
    PHP Code:
        // additional image titles
        
    $badchars = array('/','\\','.','-',' ');//not allowed in constant names
        // if any other characters could be used in filepath, add them to $badchars
        
    $add_const_name 'ADDIMG_' strtoupper(str_replace($badchars,'_',$base_image));
        if (
    defined($add_const_name)) {//add text above or below images
          
    $link = (ADDIMG_TEXT_TOP)? '<div class="addImgTitle">' constant($add_const_name) . '</div>' $link$link '<div class="addImgTitle">' constant($add_const_name) . '</div>';
        }
        
    // /additional image titles
        // List Box array generation: 
    Add to the definition file:
    PHP Code:
    define ('ADDIMG_TEXT_TOP','true'};//change to false to put text below images 
    The $badchars setup is intended to convert spaces, but apparently is unable to do so. It will handle / \ . - characters.

  7. #7

    Default Re: Adding text to additional images individually

    Quote Originally Posted by gjh42 View Post
    Just because Microsoft lets users make file/folder names with spaces doesn't mean it's a good idea...
    It is a universal computer best practice to use only letters, numbers, _, -, . and perhaps one or two other characters in filenames. Keeping letters lower case is also a good idea, as some applications are case sensitive and forgetting what you capitalized can cause unexpected problems.
    Thank you for your suggestions and info on naming images and filenames. Much appreciated! I normally try not to use spaces. From now on I will be sure to follow that rule more rigorously. Thanks!

  8. #8
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adding text to additional images individually

    A bit more study revealed that $base_image has "images/" plus the subfolder (if any) plus filename. This requires a bit more processing, as shown:
    PHP Code:
        $add_const_name 'ADDIMG_' strtoupper(str_replace($badchars,'_',ereg_replace('(^images/)','',$base_image)));

        
    $add_const_name 'ADDIMG' strtoupper(ereg_replace('(^images/)[/\\.-]','_',$base_image)));//test if this works 
        
    echo $base_image $add_const_name
    The first version just adds another function to strip "images/" from the front of the string; the second version rolls up all of the replacement into one function.

    Please try the second version so I can get more verification that it works.

    PS -
    I really like your site (I'm a potter too.) I wish you would put the "powered by Zen Cart" link back into the footer so you can add it to the showcase as an example of what can really be done with the platform.
    Last edited by gjh42; 12 Jan 2009 at 06:24 AM.

  9. #9
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adding text to additional images individually

    After local testing, here is the final version of the additional image titles code:
    PHP Code:
        // additional image titles
        
    $add_img_const 'ADDIMG_' strtoupper(ereg_replace('[/\\.-]','_',substr_replace($base_image,'',0,7)));// if any other characters could be used in filepath, add them to list [  ]
        
    if (defined($add_img_const)) {//add text above or below images
          
    $link = (ADDIMG_TEXT_TOP)? '<h4 class="addImgTitle">' constant($add_img_const) . '</h4>' $link$link '<h4 class="addImgTitle">' constant($add_img_const) . '</h4>';
        }
        
    // /additional image titles 
    I would still appreciate a field tester before submitting the mod.

  10. #10
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Adding text to additional images individually

    Additional Image Titles is now available in Free Addons.

    See the support thread for questions and further help.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 3 Sep 2013, 10:19 PM
  2. v151 Is it possible to add images/text next to additional images?
    By pexter in forum General Questions
    Replies: 6
    Last Post: 21 May 2013, 09:47 PM
  3. Can I set a zoom name for additional images individually on product page?
    By wasabiman in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 14 Apr 2010, 12:46 PM
  4. Images On and off individually
    By ollie_dda in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 11 May 2008, 06:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg