The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
[SOLVED]Avatar width resize with condition
Hello,
I'm looking for a modification like this: if the avatar width is bigger than 180px -> resize to 180px How can be made this without affect the width smaller than 180px ??? I try it this way --> In 'add plugins' -> PHP Code:
I want only the avatars that are bigger than 180px to be resized . Please help because I don't know the language that can be used .... I used ">" for definition "bigger then" but I see that doesn't work . Kind regards ! |
#2
|
||||
|
||||
$post['avwidth'] contains text, not just the number... You will have to use some php string functions to strip out everything but the number and then run the greater-than comparison.
|
#3
|
|||
|
|||
Maybe for '180px' if the condition contain text we will make the value with text to : 180px
So? |
#4
|
||||
|
||||
No, 'px' is not the issue.
$post['avwidth'] is NOT a number, It is the exact same value as $this->post['avwidth']. It is a "string" and therefore it is always greater than the string value 180 you are testing against. There are several ways to extract just the number from that string, one way is with the "substr" function: http://php.net/manual/en/function.substr.php Look at the last example in example 2: PHP Code:
PHP Code:
|
#5
|
|||
|
|||
doesn't work
|
#6
|
||||
|
||||
What hook are you using?
|
#7
|
|||
|
|||
postbit_display_complete
|
#8
|
||||
|
||||
Sorry, looks like I got the substr parameters wrong... this one should work, I tested it:L
PHP Code:
|
Благодарность от: | ||
danyxxx |
#9
|
|||
|
|||
OH MY GOD , you really really rullz this kind of things
Thanks a lot man ! (+thanks) |
Благодарность от: | ||
BirdOPrey5 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|