473,394 Members | 1,506 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

imagecreatefromgif not working

Hi, I've tried to upload a picture using the function
imagecreatefromgif, with a script as simple as possible to avoid miss
spellings and stuff like that. I've ran the following line of code to
see if my host had the right gd lib, and it was positive:

<?PHP print_r(gd_info()); ?>

so if it's not the server, what am i missing?
Here is my tiny script as it looks now:

<?php
function billede()
{
$bill = imageCreateFromGIF ("hindenburg.gif");
return $bill;
}
billede();
?>

Thanks for your help :)

Aug 10 '06 #1
16 6429
What's the error message ?
"moxmormor" <mo*******@gmail.coma écrit dans le message de news:
11**********************@i3g2000cwc.googlegroups.c om...
Hi, I've tried to upload a picture using the function
imagecreatefromgif, with a script as simple as possible to avoid miss
spellings and stuff like that. I've ran the following line of code to
see if my host had the right gd lib, and it was positive:

<?PHP print_r(gd_info()); ?>

so if it's not the server, what am i missing?
Here is my tiny script as it looks now:

<?php
function billede()
{
$bill = imageCreateFromGIF ("hindenburg.gif");
return $bill;
}
billede();
?>

Thanks for your help :)



Aug 10 '06 #2

Bob Bedford wrote:
What's the error message ?
"moxmormor" <mo*******@gmail.coma écrit dans le message de news:
11**********************@i3g2000cwc.googlegroups.c om...

There was no error message. The screen was just blank.

http://www.moxmormor.org/node.php

Aug 10 '06 #3
"moxmormor" <mo*******@gmail.coma écrit dans le message de news:
11**********************@m73g2000cwd.googlegroups. com...

Bob Bedford wrote:
What's the error message ?
"moxmormor" <mo*******@gmail.coma écrit dans le message de news:
11**********************@i3g2000cwc.googlegroups.c om...

There was no error message. The screen was just blank.

http://www.moxmormor.org/node.php

Are you sure about the file path ? try to add the complete path of the file,
maybe with a if file_exists() to be sure...and print an error message if it
doesn't exists.

Aug 10 '06 #4
Are you sure about the file path ? try to add the complete path of the file,
maybe with a if file_exists() to be sure...and print an error message if it
doesn't exists.

Now I'm confused. When it executed the following script, the output was
'nonexistant'.

<?php
function billede()
{
if (!file_exists('hindenburg.gif'))
{
$bill = imageCreateFromGIF ('hindenburg.gif');
return $bill;
}
else
echo "nonexistant";
}
billede();
?>

However, when I changed 'hindenburg.gif' to
'moxmormor_org/htdocs/hindenburg.gif' it went blank again.

Aug 10 '06 #5
Are you sure about the file path ? try to add the complete path of the file,
maybe with a if file_exists() to be sure...and print an error message if it
doesn't exists.

Now I'm confused. When it executed the following script, the output was
'nonexistant'.

<?php
function billede()
{
if (!file_exists('hindenburg.gif'))
{
$bill = imageCreateFromGIF ('hindenburg.gif');
return $bill;
}
else
echo "nonexistant";
}
billede();
?>

However, when I changed 'hindenburg.gif' to
'moxmormor_org/htdocs/hindenburg.gif' it went blank again.

Aug 10 '06 #6

"moxmormor" <mo*******@gmail.coma écrit dans le message de news:
11**********************@i42g2000cwa.googlegroups. com...
>Are you sure about the file path ? try to add the complete path of the
file,
maybe with a if file_exists() to be sure...and print an error message if
it
doesn't exists.


Now I'm confused. When it executed the following script, the output was
'nonexistant'.

<?php
function billede()
{
if (!file_exists('hindenburg.gif'))
{
$bill = imageCreateFromGIF ('hindenburg.gif');
return $bill;
}
else
echo "nonexistant";
}
billede();
?>

However, when I changed 'hindenburg.gif' to
'moxmormor_org/htdocs/hindenburg.gif' it went blank again.
You shouldn't user a path like this, instead use server variables in order
to be sure:
change moxmormor_org/htdocs/hindenburg.gif
to $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif';

also be very carefull, on Linux the filesystem is case sensitive, so
hindenburg.gif <hindenburg.GIF
Bob

Aug 10 '06 #7
You shouldn't user a path like this, instead use server variables in order
to be sure:
change moxmormor_org/htdocs/hindenburg.gif
to $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif';

also be very carefull, on Linux the filesystem is case sensitive, so
hindenburg.gif <hindenburg.GIF
Bob
Thank you, but it's still nonexistant. :(

Aug 10 '06 #8
"moxmormor" <mo*******@gmail.coma écrit dans le message de news:
11**********************@b28g2000cwb.googlegroups. com...
>You shouldn't user a path like this, instead use server variables in
order
to be sure:
change moxmormor_org/htdocs/hindenburg.gif
to $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif';

also be very carefull, on Linux the filesystem is case sensitive, so
hindenburg.gif <hindenburg.GIF
Bob

Thank you, but it's still nonexistant. :(
try a echo $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' to be sure, maybe
your config root is wrong (pointing to the wrong file). Also to be sure, put
everything in a var:

$filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif';
echo $filename;
if(file_exists($filename))
echo 'file exists';
else
echo 'file doesnt exist';

Bob

Are you on linux or XP ?

Aug 10 '06 #9
try a echo $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' to be sure, maybe
your config root is wrong (pointing to the wrong file). Also to be sure, put
everything in a var:

$filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif';
echo $filename;
if(file_exists($filename))
echo 'file exists';
else
echo 'file doesnt exist';

Bob
Pretty strange. Now the output is that the file is nonexistant, then
the full path, then that the file DOES exist.

>
Are you on linux or XP ?
I'm on a Linux server I'm pretty sure. Since they are operating with
php. My PC is XP.

Aug 10 '06 #10
"moxmormor" <mo*******@gmail.coma écrit dans le message de news:
11**********************@m79g2000cwm.googlegroups. com...
>try a echo $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' to be sure, maybe
your config root is wrong (pointing to the wrong file). Also to be sure,
put
everything in a var:

$filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif';
echo $filename;
if(file_exists($filename))
echo 'file exists';
else
echo 'file doesnt exist';

Bob

Pretty strange. Now the output is that the file is nonexistant, then
the full path, then that the file DOES exist.
Sorry I don't understand what you mean. What do you mean for output file ?
the full path is OK, are you sure on case (Linux is case sensitive,
remember), where the file DOES exists ?
>Are you on linux or XP ?

I'm on a Linux server I'm pretty sure. Since they are operating with
php. My PC is XP.
PHP can run on XP too, but if it's a professional web hosting, probably it's
on Linux.
On your page I've this result:
nonexistant/var/www/virtual/moxmormor.byethost11.com/moxmormor_org/htdocs/hindenburg.gifexistant
why there is a nonexistant and then an existant ? Your code is called twice
?
Could you send the entire code ? I'll check it for you.
I found the moxmormor.byethost11.com in your address quite strange altrough.
Bob

Aug 10 '06 #11

Bob Bedford wrote:
"moxmormor" <mo*******@gmail.coma écrit dans le message de news:
11**********************@m79g2000cwm.googlegroups. com...
try a echo $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif' to be sure, maybe
your config root is wrong (pointing to the wrong file). Also to be sure,
put
everything in a var:

$filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif';
echo $filename;
if(file_exists($filename))
echo 'file exists';
else
echo 'file doesnt exist';

Bob
Pretty strange. Now the output is that the file is nonexistant, then
the full path, then that the file DOES exist.
Sorry I don't understand what you mean. What do you mean for output file ?
The output of my commands. The output, as you can see in the code,
tells me that the two paths are alike, but the one exists and the other
doesn't.
the full path is OK, are you sure on case (Linux is case sensitive,
remember), where the file DOES exists ?
yes, I've got everything in the same folder. And I have gained access
to textfiles in that folder before.
Are you on linux or XP ?
I'm on a Linux server I'm pretty sure. Since they are operating with
php. My PC is XP.
PHP can run on XP too, but if it's a professional web hosting, probably it's
on Linux.
On your page I've this result:
nonexistant/var/www/virtual/moxmormor.byethost11.com/moxmormor_org/htdocs/hindenburg.gifexistant
why there is a nonexistant and then an existant ? Your code is called twice
?
Could you send the entire code ? I'll check it for you.
Here it is:

<?php
function billede()
{
if
(!file_exists('/var/www/virtual/moxmormor.byethost11.com/moxmormor_org/htdocs/hindenburg.gif'))
{
$bill = imageCreateFromGIF
('/var/www/virtual/moxmormor.byethost11.com/moxmormor_org/htdocs/hindenburg..gif');
return $bill;
}
else
echo "nonexistant";
}
billede();
$filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif';
echo $filename;
if(file_exists($filename))
echo 'existant';
else
echo 'nonexistant';
?>

Thank you for your effort :)
I found the moxmormor.byethost11.com in your address quite strange altrough.
I started with a free account at byethost to check it out. then I
changed to a paid solution, and got my public DNS changed or something.
There is a reasonable explanation, although I don't understand it ;)
Bob
Aug 10 '06 #12
moxmormor wrote:
Hi, I've tried to upload a picture using the function
imagecreatefromgif, with a script as simple as possible to avoid miss
spellings and stuff like that. I've ran the following line of code to
see if my host had the right gd lib, and it was positive:

<?PHP print_r(gd_info()); ?>

so if it's not the server, what am i missing?
Here is my tiny script as it looks now:

<?php
function billede()
{
$bill = imageCreateFromGIF ("hindenburg.gif");
return $bill;
}
billede();
?>
What are you expecting the script to do? It doesn't actually do
anything. It just open the gif file and doesn't produce any output.

Aug 10 '06 #13
What are you expecting the script to do? It doesn't actually do
anything. It just open the gif file and doesn't produce any output.
OK then that's why. I just expected the return statement did the job.
How should i then show the image once I've opened it?

Aug 10 '06 #14
Try this:

<?php
function billede($filename){
if(!file_exists($filename)){
$bill = imageCreateFromGIF($filename);
return $bill;
}else
echo "file already existent, cannot create new file<br>";
}
$filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif'; //this avoid a lot
of problem. Typing manually the file will get you into trouble later...
echo $filename.'<br>';
$img = billede($filename);
/*if(file_exists($filename))
echo 'existant'; //should always be called has it would be created if it
wasn't existent before or already exists.
else
echo 'nonexistant';*/
?>
>Thank you for your effort :)
np.

try this code and let me know.

Bob

Aug 10 '06 #15

Bob Bedford wrote:
Try this:

<?php
function billede($filename){
if(!file_exists($filename)){
$bill = imageCreateFromGIF($filename);
return $bill;
}else
echo "file already existent, cannot create new file<br>";
}
$filename = $_SERVER['DOCUMENT_ROOT'].'/hindenburg.gif'; //this avoid a lot
of problem. Typing manually the file will get you into trouble later...
echo $filename.'<br>';
$img = billede($filename);
/*if(file_exists($filename))
echo 'existant'; //should always be called has it would be created if it
wasn't existent before or already exists.
else
echo 'nonexistant';*/
?>
Thank you for your effort :)

np.

try this code and let me know.

Bob

what i wanted to was to show the current gif image on my site, using
php. I think I might have misunderstood the consequences of the
imageCreateFromGIF function.
But thanks anyway:)

Aug 10 '06 #16
Rik
moxmormor wrote:
>What are you expecting the script to do? It doesn't actually do
anything. It just open the gif file and doesn't produce any output.

OK then that's why. I just expected the return statement did the job.
How should i then show the image once I've opened it?
imagegif(), imagejpeg(), imagepng() etc..

imagecreatfrom..() creates an image identifier, not an image.

But why create an image in memory, and then return the same image? Unless
you do something in between, a link to the file er even readfile() is more
efficiënt.

Grtz,
--
Rik Wasmus
Aug 10 '06 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gary | last post by:
I am trying to use the "System.Windows.Forms.SendKeys" class for triggering the Ctrl+P key. Syntax: System.Windows.Forms.SendKeys.Send("^(P)"); This is not working ..what could be the...
6
by: Mullin Yu | last post by:
hi, i have a web service that has file operations on Windows OS, and there may be a file concurrency issue if only one working directory e.g. c:\working therefore, i want to have a unique sub...
3
by: | last post by:
Hello, I am hoping someone else has thought about a date time calculation i need to perform. I would like to be able to calculate the number of "working minutes" between 2 dates, given my...
5
by: Martin Heuckeroth | last post by:
Hi We are working on a webservice application and are having some problems with the cookies and/or sessions. We have them working on our intranet but then its not working on the internet. We...
5
by: tshad | last post by:
I have been working with setting my drop boxes to allow double clicking to select an item. It worked fine until I made some changes. I then stripped the page down to the bare essentials to find...
8
by: jojobar | last post by:
Okay, I am trying to do is to test the webresource in 2.0 1. I created a new project with assembly name (and default assembly name) "Office". 2. I added the following to the AssemblyInfo.cs...
2
by: Don | last post by:
I'm having problems with intellisense, autocomplete, etc. suddenly not working in certain classes of a project I'm working on. All the options are set, and it all works fine for most classes, but...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
3
by: comp.lang.php | last post by:
re: http://www.google.com/search?hl=en&q=swedish+flag&btnG=Google+Search I am trying only this: $image = @imagecreatefromgif('/path/to/this/image.gif'); This line alone causes a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.