Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2006
    Posts
    919
    Plugin Contributions
    2

    Align image with PHP...

    Is it possible, when using the zen_image function, to align the image within that piece of code?

    At the moment my code looks like this...

    Code:
    <?php echo '<a href="' . zen_href_link(FILENAME_NEWS_RSS) . '">' . zen_image($template->get_template_dir(FOOTER_IMAGE_NEWS_RSS, DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . FOOTER_IMAGE_NEWS_RSS, FOOTER_ALT_TEXT_NEWS_RSS) . '</a>'; ?>
    I am trying to center the image vertically (valign).

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Align image with PHP...

    Yes. The zen image function can take up to five parameters. The full list is zen_image(image source, alt_text, width, height, anything else you want). So it's number 5 that's of interest to you. So nothing to stop you using zen_image('....', '....', '', '', 'valign=top') where the '' are two singles quotes and not a double quote.

    I'm not entirely sure however that this will achieve the result you want as I thought that valign worked by being applied to a container to determine the alignment of its content, rather than by being applied to the content itself.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Mar 2006
    Posts
    919
    Plugin Contributions
    2

    Default Re: Align image with PHP...

    Thanks for the info. Just tested it out and it didn't work.

    I remember having a similar problem like this a while back.

    Basically, I have an image (inserted by the zen_image function) and then some text next to it. I need to move the image down by one pixel, or center it vertically.

    Maybe pasting the code will help...

    Code:
    <?php echo '<a href="' . zen_href_link(FILENAME_NEWS_RSS) . '">' . zen_image($template->get_template_dir(FOOTER_IMAGE_NEWS_RSS, DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . FOOTER_IMAGE_NEWS_RSS, FOOTER_ALT_TEXT_NEWS_RSS) . '</a>'; ?>&nbsp;&nbsp;<a href="<?php echo zen_href_link(FILENAME_NEWS_INDEX, '', 'NONSSL'); ?>"><?php echo FOOTER_LINK_NEWS; ?></a>
    Not sure how I solved the problem last time.

    Any ideas?

  4. #4
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Align image with PHP...

    Personally I wouldn't try to do this through inline styling. I'd pop a class on the A tag and position it through the stylesheet.

    If you're intent on using inline styling, then I'd pop in something that is appropriate for positioning an image such as a bit of extra margin-top.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  5. #5
    Join Date
    Mar 2006
    Posts
    919
    Plugin Contributions
    2

    Default Re: Align image with PHP...

    Quote Originally Posted by kuroi
    Personally I wouldn't try to do this through inline styling. I'd pop a class on the A tag and position it through the stylesheet.

    If you're intent on using inline styling, then I'd pop in something that is appropriate for positioning an image such as a bit of extra margin-top.
    After adding some margin-top to the image nothing happened!

    I've checked that the class is correctly linked to the image (by adding some padding - which worked).

    Also tried adding some padding-top, but again that didn't work.

    Any reason for this?

  6. #6
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Align image with PHP...

    Quote Originally Posted by Alex Clarke
    After adding some margin-top to the image nothing happened!

    I've checked that the class is correctly linked to the image (by adding some padding - which worked).

    Also tried adding some padding-top, but again that didn't work.

    Any reason for this?
    What will work depends upon the other elements in proximity to the one you're trying to position, whether they are inline or block elements and the positioning method used on each. There are too many variables to be able answer definitively without seeing the site (that's why my responses to your questions are much more vague than they usually are).
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  7. #7
    Join Date
    Mar 2006
    Posts
    919
    Plugin Contributions
    2

    Default Re: Align image with PHP...

    Ok, no problem.

    I'll have a look at other elements on the page and see what I can come up with.

    When my site finally goes live I'll be sure to post a link to it! :)

    Thanks for the help so far.

 

 

Similar Threads

  1. v150 Category Rows align text with image
    By SPH in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 29 Sep 2012, 08:51 AM
  2. Align Price and Image
    By Crooked_Halo in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 18 Jan 2012, 01:06 AM
  3. Align Search Box with Background Image
    By CompuWeb in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 7 Jan 2011, 02:37 PM
  4. #logoWrapper image align problems
    By Shane78 in forum Templates, Stylesheets, Page Layout
    Replies: 12
    Last Post: 22 Nov 2008, 02:03 AM
  5. align product image to right
    By manage-it in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 23 Dec 2006, 11:50 PM

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