473,385 Members | 1,813 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,385 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 6426
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.