Shoutbox

[img] percentage suggestion - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: General (/forumdisplay.php?fid=11)
+---- Forum: Forum & Website (/forumdisplay.php?fid=13)
+----- Thread: [img] percentage suggestion (/showthread.php?tid=30599)

[img] percentage suggestion by Mnjul on 08-28-2004 at 04:42 AM

UUDizzy is lazy.

[Image: attachment.php?pid=298528]


Well, DZ, would you add "percentage" to [img] so that we can use [img=40%]?


RE: Test by WDZ on 08-28-2004 at 04:45 AM

Can you use percentages in HTML? :-/ I've never tried...


RE: Test by Mnjul on 08-28-2004 at 04:50 AM

You can't (the percentages refers to the size of <img>'s parent element), but you should make it :refuck:


RE: Test by Chrono on 08-28-2004 at 04:50 AM

go wdz go :banana:


RE: Test by WDZ on 08-28-2004 at 04:56 AM

But the script doesn't have access to the size of the image... :p


RE: Test by Mnjul on 08-28-2004 at 05:00 AM

Parse the [img=xxx%] in PHP...get the size of the picture...calculate...output... :p

Warning! Too many steps for WDZ!


RE: Test by WDZ on 08-28-2004 at 05:02 AM

O_o

quote:
Originally posted by Mnjul
get the size of the picture
How? :refuck:
RE: Test by Mnjul on 08-28-2004 at 05:26 AM

http://www.php.net/manual/en/function.getimagesize.php


RE: Test by WDZ on 08-28-2004 at 05:28 AM

I don't like the idea of my script automatically connecting to unknown remote sites and downloading images from them... :dodgy:


RE: Test by Mnjul on 08-28-2004 at 05:31 AM

True :chrongue:


Well, you can load the image, and then use javascript to get the size, and then resize it :chrongue:

code:
<script language="javascript">
var iper=0.2;
var iwidth=document.getElementById("blah").width;
document.getElementById("blah").width=iwidth*iper;
</script>

It's working under IE and FF for me :chrongue:
Warning!! Too many steps for WDZ!
RE: Test by Chrono on 08-28-2004 at 09:12 AM

quote:
Originally posted by Mnjul
Warning!! Too many steps for WDZ!
:lol: stop doing that :lol:
RE: Test by WDZ on 08-28-2004 at 09:21 AM

That javascript, in its current format, would be quite difficult to implement.

I wonder if it could be simplified...

<img src="http://shoutbox.menthix.net/images/bunny.jpg" onload="this.width=this.width*(percentage/100);">

Of course, onload is dodgy... it doesn't always work for avatar resizing, which means it won't always work for this. :-/


RE: Test by Mnjul on 08-28-2004 at 09:56 AM

I'll think about this later on...since this is getting looked into, let's get it back F & W :p


RE: [img] percentage suggestion by jren207 on 08-28-2004 at 03:23 PM

lol, i thought you could only use percentages for tables...

It would be good for images because you wouldn't need to work out the dimensions for halving an image :D