Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Template design and Front-End Code

Post Reply
 
Thread Tools
  #1  
Old 11-24-2004, 07:21 AM
horix Offline
forum loafer
 
Join Date: Nov 2004
Posts: 6
grabbing the image width - help!

just wondering if there is a way to grab the image width.. was looking at index.php and noticed there is something about image width's with the thumbnails but i dont know php well enough to really figure out what is going on or where those vars are coming from... looking to grab the image width of the main image on display and put that width into a css width field... i know enough to know how to create the var and use the converting func to make a tag (i.e. <IMAGE_WIDTH> but i just dont know how to grab the actual width... any help will be appreciated.. thanks!

horix - galexkeene.wornpath.net
Reply With Quote
  #2  
Old 11-24-2004, 08:12 AM
pixelpunk's Avatar
pixelpunk Offline
pixelpost guru
 
Join Date: Oct 2004
Location: Sweden
Posts: 504
Send a message via ICQ to pixelpunk
Look for around line 135 in main index.php file
It should be a $image_notes... thing there.
After that, add
Code:
list($main_image_width,$main_image_height,$type,$attr) = getimagesize("images/$image_name");
$tpl = ereg_replace("<MAIN_IMAGE_WIDTH>",$main_image_width,$tpl); 
$tpl = ereg_replace("<MAIN_IMAGE_HEIGHT>",$main_image_height,$tpl);
and you're all set with brand new width and height tags to use in the template.

// punk
__________________
icq: 66760929
Reply With Quote
  #3  
Old 11-24-2004, 10:22 AM
horix Offline
forum loafer
 
Join Date: Nov 2004
Posts: 6
i put in that code, but its not working... i put the tag in the page just as text, to test it out and instead of a number its outputting an e with an accent on it... i guess its using the number as a character code instead of just being a number? wondering where the formatting is wrong here.. thanks for the help!
Reply With Quote
  #4  
Old 11-24-2004, 10:29 AM
pixelpunk's Avatar
pixelpunk Offline
pixelpost guru
 
Join Date: Oct 2004
Location: Sweden
Posts: 504
Send a message via ICQ to pixelpunk
I would guess you need to zap some gremlins

When copy/pasting from the web invisible stuff comes along.
Open it up in whatever texteditor you use, notepad, bbedit or the likes, and look for invisible and weird characters and delete them.

// punk
__________________
icq: 66760929
Reply With Quote
  #5  
Old 11-24-2004, 10:36 AM
horix Offline
forum loafer
 
Join Date: Nov 2004
Posts: 6
nope.. looks clean to me... reuploaded just to make sure... and now my site is broken... :-\
Reply With Quote
  #6  
Old 11-24-2004, 12:36 PM
pixelpunk's Avatar
pixelpunk Offline
pixelpost guru
 
Join Date: Oct 2004
Location: Sweden
Posts: 504
Send a message via ICQ to pixelpunk
If your site is broken I would still guess there are some funkyness with invisible characters.

Can you send me a .zip of your index.php file?

punk [at] pixelpunk.se

// pixel
__________________
icq: 66760929
Reply With Quote
  #7  
Old 12-06-2004, 01:05 AM
winklebleck Offline
pp regular
 
Join Date: Dec 2004
Posts: 26
TROUBLE TOO

The replace part is working, but the it's not replacing with the right info. Keep getting odd things entered into the tags. here are some samples.

Code:
width="" height=""
width="" height="*"
width="" height=""
Scott
Reply With Quote
  #8  
Old 12-06-2004, 02:58 AM
horix Offline
forum loafer
 
Join Date: Nov 2004
Posts: 6
Hey... I PM'd punk about this and he went and fixed the problem, here is the correct code:

Code:
list($image_width,$image_height,$imtype,$imattr) = getimagesize("images/$image_name"); 
$img_width = $image_width; 
$tpl = ereg_replace("<IMAGE_WIDTH>","$img_width",$tpl);
That will only give you width... if you copy the last two lines and replace every "width" with "height" and youre good to go on both
Reply With Quote
  #9  
Old 12-06-2004, 04:15 PM
winklebleck Offline
pp regular
 
Join Date: Dec 2004
Posts: 26
Money

There you go! that did it.

Thank you both
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 04:27 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs