Business Advice and Help Forum for Businesses or Starting a Company in the UK - A1 Business Forums
corner image corner image
Member Box




corner image corner image
Our Advertisers

corner image corner image
Register FAQ Members List Today's Posts Search Today's Posts Mark Forums Read
A1 Business Blog Home
corner image corner image
A1businessforums.co.uk - The UK's Friendliest Online Business Community
Go Back   Business Forum UK - Advice Help and Questions - A1 Forums > Business Forums > Graphic Design, Web Design and Coding
Reload this Page

Really need some help - centering images

Designers Forum for Graphic, Logo or Print Design and Photography plus Website Design, Coding, Themes and Skins

Reply
Page 1 of 2 1 2 >
corner image corner image
 
LinkBack Thread Tools Display Modes

corner image corner image
  #1 (permalink)  
Old 18-06-2008, 15:42
HuggyBear's Avatar
HuggyBear HuggyBear is offline
I Live on A1!
 
Join Date: May 2008
Location: Darlington
Posts: 634
Thanks: 105
Thanked 86 Times in 80 Posts
Default Really need some help - centering images

Im trying to vertically align images in my image block, example here:

http://cpsdirect.co.uk/product_info....oducts_id=4992

The images are scaled automatically on the fly to fit the size of the box , but how do I align the image vertically central to the 250x250 box?

vertical-align doesnt work
margin-top:auto;
margin-bottom:auto;

doesnt work either, any ideas?

TIA

S
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookStumble this Post!Google Bookmark this Post!
Reply With Quote
corner image corner image
Sponsored Links

Register to remove these ads
HuggyBear
View Public Profile
Send a private message to HuggyBear
Visit HuggyBear's homepage!
Find all posts by HuggyBear
corner image corner image
  #2 (permalink)  
Old 18-06-2008, 19:46
HuggyBear's Avatar
HuggyBear HuggyBear is offline
I Live on A1!
 
Join Date: May 2008
Location: Darlington
Posts: 634
Thanks: 105
Thanked 86 Times in 80 Posts
anyone?

Is it really as hard as it looks?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookStumble this Post!Google Bookmark this Post!
Reply With Quote
HuggyBear
View Public Profile
Send a private message to HuggyBear
Visit HuggyBear's homepage!
Find all posts by HuggyBear
corner image corner image
  #3 (permalink)  
Old 18-06-2008, 19:53
Peter W's Avatar
Peter W Peter W is offline
Blog Entry: Capital gains tax on selling a property within ...
A1 is my Second Home!
 
Join Date: Mar 2008
Location: Brighton and Hove
Posts: 303
Thanks: 35
Thanked 91 Times in 80 Posts
I'm really no expert, but try "valign=middle" in your HTML.
__________________
Brighton and Hove Accountants > Tax returns - Payroll - New businesses - Limited companies
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookStumble this Post!Google Bookmark this Post!
Reply With Quote
corner image corner image
The Following User Says Thank You to Peter W For This Useful Post:
HuggyBear (18-06-2008)
Peter W
View Public Profile
Send a private message to Peter W
Visit Peter W's homepage!
Find all posts by Peter W
corner image corner image
  #4 (permalink)  
Old 18-06-2008, 20:04
HuggyBear's Avatar
HuggyBear HuggyBear is offline
I Live on A1!
 
Join Date: May 2008
Location: Darlington
Posts: 634
Thanks: 105
Thanked 86 Times in 80 Posts
Yeah, I tried that, doesnt work tho :sad1:
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookStumble this Post!Google Bookmark this Post!
Reply With Quote
HuggyBear
View Public Profile
Send a private message to HuggyBear
Visit HuggyBear's homepage!
Find all posts by HuggyBear
corner image corner image
  #5 (permalink)  
Old 18-06-2008, 20:33
tommy's Avatar
tommy tommy is offline
Blog Entry: IE6 Issue fixed for 3 column layout seo (search...
A1 is my Second Home!
 
Join Date: Mar 2008
Location: Essex
Posts: 376
Thanks: 45
Thanked 97 Times in 85 Posts
Sorry huggy I have been looking into this for the past 2-3 hours and I can not find anyway of doing unless you was to re-write a large chunk of code.

I think the main reason is you are scaling down the images. I will looking into a DOM modification but I can not guarantee anything.
__________________
Townhouse holiday home to rent in La Zenia, south of Torrevieja
HTML Source - for all your XHTML & CSS needs
DVD's | DVD Players | HD TV's | Home Cinema - all under one site

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookStumble this Post!Google Bookmark this Post!
Reply With Quote
corner image corner image
The Following User Says Thank You to tommy For This Useful Post:
HuggyBear (18-06-2008)
tommy
View Public Profile
Send a private message to tommy
Visit tommy's homepage!
Find all posts by tommy
corner image corner image
  #6 (permalink)  
Old 18-06-2008, 20:36
HuggyBear's Avatar
HuggyBear HuggyBear is offline
I Live on A1!
 
Join Date: May 2008
Location: Darlington
Posts: 634
Thanks: 105
Thanked 86 Times in 80 Posts
Quote:
Originally Posted by tommy View Post
Sorry huggy I have been looking into this for the past 2-3 hours and I can not find anyway of doing unless you was to re-write a large chunk of code.

I think the main reason is you are scaling down the images. I will looking into a DOM modification but I can not guarantee anything.

But they are scaled down before being sent to the visitors browser

PHP Code:
function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {

  
// if no file exists display the 'no image' file
  
if (!is_file($src)) {
  
$src = "images/no_image.jpg";
  }
    
// Set default image variable and code
    
$image = '<img src="' . $src . '"';
    
// Don't calculate if the image is set to a "%" width
    
if (strstr($width,'%') == false || strstr($height,'%') == false) {
        
$dont_calculate = 0;
    } else {
        
$dont_calculate = 1;
    }
    
// Dont calculate if a pixel image is being passed (hope you dont have pixels for sale)
    
if (!strstr($image, 'pixel')) {
        
$dont_calculate = 0;
    } else {
        
$dont_calculate = 1;
    }
    
// Do we calculate the image size?
    
if (CONFIG_CALCULATE_IMAGE_SIZE && !$dont_calculate) {
        
// Get the image's information
        
if ($image_size = @getimagesize($src)) {
            
$ratio = $image_size[1] / $image_size[0];
            
// Set the width and height to the proper ratio
            
if (!$width && $height) {
                
$ratio = $height / $image_size[1];
         
$width = intval($image_size[0] * $ratio);
      } elseif (
$width && !$height) {
                
$ratio = $width / $image_size[0];
                
$height = intval($image_size[1] * $ratio);
            } elseif (!
$width && !$height) {
                
$width = $image_size[0];
                
$height = $image_size[1];
            }
            
// Scale the image if not the original size
            
if ($image_size[0] != $width || $image_size[1] != $height) {
                
$rx = $image_size[0] / $width;
                
$ry = $image_size[1] / $height;
                if (
$rx < $ry) {
                    
$width = intval($height / $ratio);
                } else {
                    
$height = intval($width * $ratio);
                }
        
       
// $image = '<img src="product_thumb.php?img=' . $src . '&amp;w=100&h=100"';
                
$image = '<img src="product_thumb.php?img=' . $src . '&amp;w=' .
                
tep_output_string($width) . '&amp;h=' . tep_output_string($height) . '"';
            }
        } elseif (
IMAGE_REQUIRED == 'false') {
            return 
'';
        } 
I don;t know if you understand PHP or not but that is the script that creates the thumbs and then stores them in a directory so it doesnt have to create that thumb again,

I have tried changing CSS anmd everything and the only thing that gets the images away from the top is to set margin-top to a fixed height which is no good...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookStumble this Post!Google Bookmark this Post!
Reply With Quote
HuggyBear
View Public Profile
Send a private message to HuggyBear
Visit HuggyBear's homepage!
Find all posts by HuggyBear
corner image corner image
  #7 (permalink)  
Old 18-06-2008, 20:40
tommy's Avatar
tommy tommy is offline
Blog Entry: IE6 Issue fixed for 3 column layout seo (search...
A1 is my Second Home!
 
Join Date: Mar 2008
Location: Essex
Posts: 376
Thanks: 45
Thanked 97 Times in 85 Posts
Quote:
Originally Posted by HuggyBear View Post
But they are scaled down before being sent to the visitors browser

PHP Code:
function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {

  
// if no file exists display the 'no image' file
  
if (!is_file($src)) {
  
$src = "images/no_image.jpg";
  }
    
// Set default image variable and code
    
$image = '<img src="' . $src . '"';
    
// Don't calculate if the image is set to a "%" width
    
if (strstr($width,'%') == false || strstr($height,'%') == false) {
        
$dont_calculate = 0;
    } else {
        
$dont_calculate = 1;
    }
    
// Dont calculate if a pixel image is being passed (hope you dont have pixels for sale)
    
if (!strstr($image, 'pixel')) {
        
$dont_calculate = 0;
    } else {
        
$dont_calculate = 1;
    }
    
// Do we calculate the image size?
    
if (CONFIG_CALCULATE_IMAGE_SIZE && !$dont_calculate) {
        
// Get the image's information
        
if ($image_size = @getimagesize($src)) {
            
$ratio = $image_size[1] / $image_size[0];
            
// Set the width and height to the proper ratio
            
if (!$width && $height) {
                
$ratio = $height / $image_size[1];
         
$width = intval($image_size[0] * $ratio);
      } elseif (
$width && !$height) {
                
$ratio = $width / $image_size[0];
                
$height = intval($image_size[1] * $ratio);
            } elseif (!
$width && !$height) {
                
$width = $image_size[0];
                
$height = $image_size[1];
            }
            
// Scale the image if not the original size
            
if ($image_size[0] != $width || $image_size[1] != $height) {
                
$rx = $image_size[0] / $width;
                
$ry = $image_size[1] / $height;
                if (
$rx < $ry) {
                    
$width = intval($height / $ratio);
                } else {
                    
$height = intval($width * $ratio);
                }
        
       
// $image = '<img src="product_thumb.php?img=' . $src . '&amp;w=100&h=100"';
                
$image = '<img src="product_thumb.php?img=' . $src . '&amp;w=' .
                
tep_output_string($width) . '&amp;h=' . tep_output_string($height) . '"';
            }
        } elseif (
IMAGE_REQUIRED == 'false') {
            return 
'';
        } 
I don;t know if you understand PHP or not but that is the script that creates the thumbs and then stores them in a directory so it doesnt have to create that thumb again,

I have tried changing CSS anmd everything and the only thing that gets the images away from the top is to set margin-top to a fixed height which is no good...
my mistake I thought you meant scaling by just changing the width and not creating a totally new thumbnail image.
__________________
Townhouse holiday home to rent in La Zenia, south of Torrevieja
HTML Source - for all your XHTML & CSS needs
DVD's | DVD Players | HD TV's | Home Cinema - all under one site

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookStumble this Post!Google Bookmark this Post!
Reply With Quote
tommy
View Public Profile
Send a private message to tommy
Visit tommy's homepage!
Find all posts by tommy
corner image corner image
  #8 (permalink)  
Old 18-06-2008, 20:43
HuggyBear's Avatar
HuggyBear HuggyBear is offline
I Live on A1!
 
Join Date: May 2008
Location: Darlington
Posts: 634
Thanks: 105
Thanked 86 Times in 80 Posts
Quote:
Originally Posted by tommy View Post
my mistake I thought you meant scaling by just changing the width and not creating a totally new thumbnail image.
Sorry, probably didnt explain it properly...

The script which i use to scroll the images is called ContentSlider can get it from DynamicDrive.com, im thinking it could be something in there...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookStumble this Post!Google Bookmark this Post!
Reply With Quote
HuggyBear
View Public Profile
Send a private message to HuggyBear
Visit HuggyBear's homepage!
Find all posts by HuggyBear
corner image corner image
  #9 (permalink)  
Old 18-06-2008, 20:48
SBP's Avatar
SBP SBP is offline
A1 is my Second Home!
 
Join Date: Mar 2008
Posts: 199
Thanks: 9
Thanked 49 Times in 45 Posts
I vaguely remember something about vertical align not working

A quick search on google ("vertical align") brought this:

http://phrogz.net/CSS/vertical-align/index.html

seems to have all the answers
__________________
Starting or running a small business then here's small business marketing and startup help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookStumble this Post!Google Bookmark this Post!
Reply With Quote
corner image corner image
The Following User Says Thank You to SBP For This Useful Post:
HuggyBear (18-06-2008)
SBP
View Public Profile
Send a private message to SBP
Visit SBP's homepage!
Find all posts by SBP
corner image corner image
  #10 (permalink)  
Old 18-06-2008, 21:08
HuggyBear's Avatar
HuggyBear HuggyBear is offline
I Live on A1!
 
Join Date: May 2008
Location: Darlington
Posts: 634
Thanks: 105
Thanked 86 Times in 80 Posts
OK, i kind of got it, not 100% but I that is down to the images themselves - 1 is portrait whereas the rest are landscape...

Thanks for your help guys...

Goes without saying Google really is your friend...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookStumble this Post!Google Bookmark this Post!
Reply With Quote
HuggyBear
View Public Profile
Send a private message to HuggyBear
Visit HuggyBear's homepage!
Find all posts by HuggyBear
Reply
Page 1 of 2 1 2 >

« Photographs required | url rewriting for vBulletin »

corner image corner image
Thread Tools
Show Printable Version