![]() |
Calling an image
A few quick questions that would truly help me complete a project i'm working on.
I have the following script that generates an image. The script works great, but heres where I'm stuck: I need to call the image it generates from an HTML file. So, in that file I'm unsure on how to tell the script to execute and then go out and grab the generated image. PHP Code:
|
What I would do is add the following code:
html4strict Code:
Obviously you don't want to resize every time, so check the size of the image and then decide whether to refresh or not. Embed the actual image in the PHP file once done, and set the content-type. |
Actually, I need the gif to resize everytime. So, I'll need the script to execute first and then call the image to display on screen.
|
why do you use the function before it is declared?
And if that is a complete copy / paste then you need a closing bracket "}" for the function.. But as Wildhoney says, that is the way i would prefer it to be done, but be aware that is you use some sort of external input in the script, like a $_GET or $_POST, it could evolve into some sort of security breach, but as it is now it is okay :) And by the way, you don't have to declare variables twice? I refer to these: PHP Code:
|
Quote:
-m |
Didn't know that :-$ after all those years with casual programming :-!
|
Well, I'm stuck at the moment. I keep getting an
Quote:
I'm confused abit on GET & POST. Is that something I call on the html file? this particular page is only going to open locally, so I'm not too overly concerned about security. I'd just like it to work. |
GET and POST are different methods of sending user input to the server, GET is values in the url like:
Code:
http://example.com/?get=thisPOST on the other is a bit more complicated but indeed possible to manipulate, but if you know some basic PHP you will be able to secure your self. But POST is the most popular way of sending form data into a PHP script. A simple code snippet with POST... PHP Code:
|
Ok. I'll dive into it here shortly. I have to fix this darn error first.
|
You're running your server on Windows Vista arencha? Don't worry, that error doesn't mean you need to put your computer up on cinder blocks or on the second floor, as some may suspect. Chances are if you're running Vista, you just need to turn off the damned UAC, which should never have been turned on in the first place... didja know somebody at MS actually admitted they added that to Vista to annoy the shit out of people? Because apparently if you annoy the crap outta people, they don't try and mess with sensitive system settings.... OR... they buy a Mac. Dumba**es.
Anywho. You can turn UAC off by running msconfig, hopping over to the tools tab, and selecting the Disable UAC option. It'll make your life much happier all in all even if this isn't your problem. -m |
Ok. Somehow. After changing all the exe to "Run as Administrator" (go figure this was MS's doing) I don't get an error. I've also disabled UAC for good measure.
Now my problem is that every time I hit preview my script from the editor it only display the script on the browser and does not run the script. |
Ok. I'm back in business. Thank you everyone. Now to get back to making this script work. The funny thing is that this script was working fine. Now sure what I've done in the past few days...I know i've been playing around w/ all the various apache and php files.
I'm now getting the following error: Quote:
|
Sounds like when you reinstalled, PHP wasn't compiled with GD support. You can check phpinfo() to see if it lists the GD module, function_exists('gd_info') or open your PHP.ini and search for the following:
If you don't see that, then you don't have GD, which means you don't have imagecreatefromgif() -m |
how do I check phpinfo()? Also, I've check the php.ini and i've check the apache\bin\php.ini and both have the "extension=php_gd2.dll". Is there a way to see if the gd2.dll is the correct one?
|
PHP Code:
-m edit: To make sure the dll is there, it should be in your path\to\PHP\ext\ folder, named php_gd2.dll |
Now something i did notice is that the php.ini didn't have a section [PHP_GD2] like you had above, it just listed the dll along w/ the other extensions.
|
YOU ROCK!!! I've never noticed this. Its actually pretty cool. I'm seeing that the php info is going off an old php install that I had, before xampp. How can I go and switch that up...or should I? The reason why I went w/ xampp is because it had phpcgi.exe, where the install of Php that I had original didn't have that.
|
Honestly I don't have the foggiest if it makes a difference or not. My php.ini looks like this as far as to how it lists modules;
So I would assume so, but I don't like assuming. Sounds like with all the troubles your having though it may be an idea in the future to try a different WAMP or give a go at installing by hand (my preferred method). -m |
Quote:
Hope this helps. -m |
M
You are a Godsend! I'm back in business! Now, I'm back trying to figure out how to have an html file, force my script above to display the image. I've tried <img src=test.php/>, but all I get is a box w/ an x in it. I have to some how tell the script to echo the image directly instead of saving it as a file...maybe?? |
| All times are GMT. The time now is 11:48 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0