Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-19-2012, 05:08 PM
m002.p's Avatar
m002.p m002.p is offline
 
Join Date: Jan 2007
Location: Worcester
Posts: 240
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Avatar Resizing

Hi guys,

Have a weird one here but I want to resize an avatar displayed using %. However, when doing it with the below method the image does not display.

Code:
<a href="profile.php?{$session[sessionurl]}do=editavatar"><img src="/forum/image.php?u={$bbuserinfo['userid']}" width="30%" height="30%"></a>
So, if this cant be solved, I was hoping it could be done with an edit to image.php allowing the use of height & width. For example:

Code:
/image.php?u=45&height=30%&width=30%
Any ideas how I can get either to work?

Matt
Reply With Quote
  #2  
Old 07-19-2012, 07:06 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It seems to me like the first code you posted works. I'm not an html expert, but I think 30% could mean a different thing depending on where you put the code. Also, if a user has no avatar the image will be blank.
Reply With Quote
  #3  
Old 07-19-2012, 07:28 PM
m002.p's Avatar
m002.p m002.p is offline
 
Join Date: Jan 2007
Location: Worcester
Posts: 240
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

Thanks for your reply.

The code is used in a template on the forumhome.

The image with the first code simply does not show whereas change it to a pixel ie. width="200" works. It seems to be a problem with the percentage for the img tag.
Reply With Quote
  #4  
Old 07-19-2012, 10:13 PM
peterska2 peterska2 is offline
 
Join Date: Oct 2003
Location: Manchester, UK
Posts: 6,504
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by m002.p View Post
Hi guys,

Have a weird one here but I want to resize an avatar displayed using %. However, when doing it with the below method the image does not display.

Code:
<a href="profile.php?{$session[sessionurl]}do=editavatar"><img src="/forum/image.php?u={$bbuserinfo['userid']}" width="30%" height="30%"></a>
So, if this cant be solved, I was hoping it could be done with an edit to image.php allowing the use of height & width. For example:

Code:
/image.php?u=45&height=30%&width=30%
Any ideas how I can get either to work?

Matt
I don't see any reason why the first one wouldn't work, but IIRC percentages and divs don't tend to play nice so might need to stick a single cell table in there. You shouldn't have { and } in vB3 templates either.

Try

Code:
<table border="0" cellpadding="0" cellspacing="0"><tr><td><a href="profile.php?$session[sessionurl]do=editavatar"><img src="/forum/image.php?u=$bbuserinfo[userid]" width="30%" height="30%"></a></td></tr></table>
Should do the trick if memory serves me correctly

Of course, this is working on the assumption that you already have the avatar displaying on forumhome without any resizing taking place.
Reply With Quote
  #5  
Old 07-19-2012, 10:25 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by peterska2 View Post
...You shouldn't have { and } in vB3 templates either.
The curly braces are php "complex syntax", it allows you to use more "complex" variables in a string, like an array element with the key in quotes.
Reply With Quote
  #6  
Old 07-19-2012, 10:29 PM
peterska2 peterska2 is offline
 
Join Date: Oct 2003
Location: Manchester, UK
Posts: 6,504
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
The curly braces are php "complex syntax", it allows you to use more "complex" variables in a string, like an array element with the key in quotes.
Yes, they are but they still don't belong there in this case
Reply With Quote
  #7  
Old 07-19-2012, 10:50 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by peterska2 View Post
Yes, they are but they still don't belong there in this case
Not to make a big deal out of it, but I disagree - they "belong" there in the original code because there are quotes around the array key and it wouldn't work without the curly braces. You can remove the quotes as you did, but it doesn't mean the original code was wrong. Also, there are some situations where there's no other way to insert a variable, such as a multi-dimension array, an object, or if adjacent characters in the string would cause ambiguity.
Reply With Quote
  #8  
Old 07-20-2012, 06:58 AM
m002.p's Avatar
m002.p m002.p is offline
 
Join Date: Jan 2007
Location: Worcester
Posts: 240
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry to say but that code doesnt work either. The avatar simply does not display...

Cant get my head round it... change the height & width to pixels and it works fine.

Furthermore, no. The avatar does not already display on the forumhome Peterska. I am adding a welcome tempate to the top of the forumhome in vb3.

My only option may be hard coding it into the image.php file?
Reply With Quote
  #9  
Old 07-20-2012, 10:36 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Which browser are you using? Can you show us a little more of the code around where you're putting it?

I don't think changing image.php would work because it wouldn't have any way to know what "30%" meant, and even if it did you would need to call a funciton to resize the mage.
Reply With Quote
  #10  
Old 07-20-2012, 07:56 PM
m002.p's Avatar
m002.p m002.p is offline
 
Join Date: Jan 2007
Location: Worcester
Posts: 240
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes here is the template. It is a modification of a welcome panel here on vb.org

Code:
<if condition="$vbulletin->options['onoff']">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat" colspan="3" align="left">
		<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_welcomepanel')"><img id="collapseimg_forumhome_welcomepanel" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_welcome_panel].gif" alt="" border="0" /></a>
<phrase 1="{$bbuserinfo['username']}">$vbphrase[wp_welcomeback]</phrase>
	</td>
</tr>
<tbody id="collapseobj_forumhome_welcomepanel" style="$vbcollapse[collapseobj_forumhome_welcomepanel]">
	<tr>
		<td class="alt1" align="center" width="1%">
		<table border="0" cellpadding="0" cellspacing="0"><tr><td><a href="profile.php?$session[sessionurl]do=editavatar"><img src="/forum/image.php?u=$bbuserinfo[userid]" width="30%" height="30%"></a></td></tr></table>
		</td>
		<td width="50%" class="alt2" align="$stylevar[left]" valign="top">
		<phrase 1="{$bbuserinfo['newposts']}" 2="{$bbuserinfo['newthreads']}" 3="{$bbuserinfo['lastvisit']}" 4="$timenow" 5="$datenow" 6="{$bbuserinfo['pmunread']}" 7="{$wp['newpostsplural']}" 8="{$wp['newthreadsplural']}">$vbphrase[wp_unread]</phrase>

<if condition="$vbulletin->options['rules']">
<br /><br />
<phrase 1="$vboptions[ruleid]">$vbphrase[wp_rules]</phrase>
</if>

<if condition="$vbulletin->options['showlatestannouncement']">
<br /><if condition="!$vbulletin->options['rules']"><br /></if>
<table border="0"><tr><td><img src="/forum/images/icons/icon4.gif"></td>
<td>
<phrase 1="$wp_forum_title" 2="$wp_latest_a_link" 3="$wp_latest_a_title">$vbphrase[wp_latestannouncement]</phrase>
</td>
</tr>
</table>
</if>
		

		</td>
		<td width="50%" class="alt1" align="$stylevar[left]" valign="top">
		<phrase 1="{$bbuserinfo['posts']}" 2="$wp_user_thread_count" 3="{$bbuserinfo['postsperday']}" 4="{$bbuserinfo['postpercent']}">$vbphrase[wp_user_stats]</phrase>
		<if condition="$bbuserinfo[active]">
		<b>&raquo;</b> $vbphrase[wp_activity] <a href="forumdisplay.php?{$session[sessionurl]}f={$bbuserinfo[active][0][forumid]}">{$bbuserinfo[active][0][title]}</a> $vbphrase[wp_activity2] <b>{$bbuserinfo[active][1]}</b> $vbphrase[wp_activity3].<br />
		<else />
		$vbphrase[wp_activity] <i>N/A</i><br />
		</if>

<!--BEGIN VB STATUS-->
<if condition="$vbulletin->options['vbstatus_active']">
<if condition="$bbuserinfo[vbstatus_status]">
<font size="1">$bbuserinfo[musername] {$vbulletin->options['vbstatus_statusprefix']}</font>
	<em id="vbstatus_$bbuserinfo[userid]">
	<font size="1"><i>$bbuserinfo[vbstatus_status]</i></font>
	<if condition="$bbuserinfo['userid']==$userinfo['userid'] OR is_member_of($bbuserinfo, 9, 10, 11)">
			<a href="javascript:Att_Ajax('userid=$bbuserinfo[userid]&postid=$bbuserinfo[userid]','vbstatus/vbstatus_ajax.php')"><font size="1">Edit</font></a>
	
	</if>	
	</em>
<else />
<if condition="$bbuserinfo['userid']==$bbuserinfo['userid']">
			<br /><br /><a href="javascript:Att_Ajax('userid=$bbuserinfo[userid]&postid=$bbuserinfo[userid]','vbstatus/vbstatus_ajax.php')"><font size="1">Add New Status</font></a>
	
	</if>	
</if>
</if>
<!--END VB STATUS-->
<br /><br />

		</td>
	</tr>
</tbody>
</table>
<br />
</if>
You can see the code in question near the top.

Well it would sure be possible to send just the GET vars to the php file to then add the % in the variable outputs in the php code?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:28 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08703 seconds
  • Memory Usage 2,275KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete