Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Changing image width  (Read 3695 times)

0 Members and 1 Guest are viewing this topic.

Helpmeh

    Topic Starter


    Guru

  • Roar.
  • Thanked: 123
    • Yes
    • Yes
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Changing image width
« on: September 20, 2009, 07:36:00 PM »
Hey, I'm trying to think up a way to change the width of an image depending on a number which will be entered by the user. I created a quick example of what I am looking for in Microsoft Visual Basic (which I accessed through MSWord 2003) and it is attached. Just enter a number in the text box and hit the command button next to it, then the top button's width will change accordingly.

[attachment deleted by admin]
Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.

kpac

  • Web moderator
  • Moderator


  • Hacker

  • kpac®
  • Thanked: 184
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 7
Re: Changing image width
« Reply #1 on: September 23, 2009, 09:47:11 AM »
Is this not programming?

Helpmeh

    Topic Starter


    Guru

  • Roar.
  • Thanked: 123
    • Yes
    • Yes
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: Changing image width
« Reply #2 on: September 23, 2009, 05:10:13 PM »
Is this not programming?
No, it's web design. I just showed an example of what I meant in MSVB. I'm sorry I didn't add that part in before, the page refreshed after switching tabs, so I lost all I wrote. 
« Last Edit: September 23, 2009, 06:21:55 PM by Helpmeh »
Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.

kpac

  • Web moderator
  • Moderator


  • Hacker

  • kpac®
  • Thanked: 184
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 7
Re: Changing image width
« Reply #3 on: September 24, 2009, 02:02:38 PM »
What language are you using? JavaScript? PHP?

Helpmeh

    Topic Starter


    Guru

  • Roar.
  • Thanked: 123
    • Yes
    • Yes
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: Changing image width
« Reply #4 on: September 24, 2009, 05:09:25 PM »
What language are you using? JavaScript? PHP?
Well I don't know PHP at all, but any language is appreciated if it can be done (and I can use it).
Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.

Geek-9pm


    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: Changing image width
« Reply #5 on: September 24, 2009, 05:29:51 PM »
Likely JavaScript if you want it on a web site.
Here is one place to look:
http://javascript.internet.com/
Even if you don't find anything, the girl is cute

Helpmeh

    Topic Starter


    Guru

  • Roar.
  • Thanked: 123
    • Yes
    • Yes
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: Changing image width
« Reply #6 on: September 24, 2009, 07:58:33 PM »
Even if you don't find anything, the girl is cute

WHAT?
Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.

kpac

  • Web moderator
  • Moderator


  • Hacker

  • kpac®
  • Thanked: 184
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 7
Re: Changing image width
« Reply #7 on: September 25, 2009, 09:58:39 AM »
WHAT?
Eh, never mind.

Err, try this for size:

Code: [Select]
<html>
<head>
  <title>JS Test</title>
</head>

<body>
  <script type="text/javascript">
    var size = prompt("Please enter a size for the image.","45");
    if (size != null && size != "")
    {
      document.write("<img src='path/to/image' width=' + size + ' />");
    }
  </script>
</body>
</html>

Helpmeh

    Topic Starter


    Guru

  • Roar.
  • Thanked: 123
    • Yes
    • Yes
  • Computer: Specs
  • Experience: Familiar
  • OS: Windows 8
Re: Changing image width
« Reply #8 on: September 25, 2009, 06:56:00 PM »
I can't test this right now, but can it be changed after the image has been displayed once, or is it a one-time thing per load?
Where's MagicSpeed?
Quote from: 'matt'
He's playing a game called IRL. Great graphics, *censored* gameplay.

Geek-9pm


    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: Changing image width
« Reply #9 on: September 25, 2009, 09:38:03 PM »
JavaScript can reload an image without reloading the who page.