470,815 Members | 1,324 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Function returns nothing (instead of flash)

Hi there,

I have a site with just a few pages. (e.g. home.php)
In every page there is another page included with things
like the header etc.

The included file is in a subdirectory called "include".
There are two functions written in this included file:

================================================== =========================
function doImage($image)
{
list($width, $height, $type, $attr) = getimagesize($image);
echo "<img src=$image width=\"$width\" height=\"$height\">";
};

function doFlash($Movie,$Height,$Width)
{
echo "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\"
height=\"$Height\" width=\"$Width\">
<param name=\"movie\" value=\"$Movie\">
<param name=\"quality\" value=\"high\">
<param name=\"allowscale\" value=\"true\">
<param name=\"SCALE\" value=\"exactfit\">
<param name=\"menu\" value=\"false\">
<param name=\"wmode\" value=\"transparent\">
<embed src=\"$Movie\" width=\"$Width\" height=\"$Height\"
menu=\"false\" wmode=\"transparent\" allowscale=\"true\"
scale=\"exactfit\" quality=\"high\"
pluginspage=\"http://www.macromedia.com/go/getflashplayer\"
type=\"application/x-shockwave-flash\"></embed>
</object>";
};
================================================== =========================

I call the functions from pages in the root directory, pages like
home.php...

When i call doImage("img/logo.gif"); it works well, but when i
call doFlash("swf/logo.swf","100px","100px"); It returns everything
before
the <html> tag starts, so it isn't in the right place either. When i
change
the "echo"-statement of doFlash() to "return" nothing happens and it
disappears in the source (online)

What am i doing wrong?

Hope someone can help...

Greetings knoakske
Jul 17 '05 #1
7 2064
knoak wrote:
Hi there,

I have a site with just a few pages. (e.g. home.php)
In every page there is another page included with things
like the header etc.

The included file is in a subdirectory called "include".
There are two functions written in this included file:

================================================== =========================
function doImage($image)
{
list($width, $height, $type, $attr) = getimagesize($image);
echo "<img src=$image width=\"$width\" height=\"$height\">";
};

function doFlash($Movie,$Height,$Width)
{
echo "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\"
height=\"$Height\" width=\"$Width\">
<param name=\"movie\" value=\"$Movie\">
<param name=\"quality\" value=\"high\">
<param name=\"allowscale\" value=\"true\">
<param name=\"SCALE\" value=\"exactfit\">
<param name=\"menu\" value=\"false\">
<param name=\"wmode\" value=\"transparent\">
<embed src=\"$Movie\" width=\"$Width\" height=\"$Height\"
menu=\"false\" wmode=\"transparent\" allowscale=\"true\"
scale=\"exactfit\" quality=\"high\"
pluginspage=\"http://www.macromedia.com/go/getflashplayer\"
type=\"application/x-shockwave-flash\"></embed>
</object>";
};
================================================== =========================

I call the functions from pages in the root directory, pages like
home.php...

When i call doImage("img/logo.gif"); it works well, but when i
call doFlash("swf/logo.swf","100px","100px"); It returns everything
before
the <html> tag starts, so it isn't in the right place either. When i
change
the "echo"-statement of doFlash() to "return" nothing happens and it
disappears in the source (online)
It will disappear .. by removing "echo", you're telling PHP *not* to
put the code into the end webpage. "return" just makes the function
return a value, so that it's available to be used in another part of
your code.. If you wish to echo that return value, you must specify
when calling the function that you want to echo it's return value.

(Think of the return value of a function in the same way you would think
of a constant variable)
What am i doing wrong?

Hope someone can help...

Greetings knoakske

--
Ben Cottrell AKA Bench

Disclaimer:
This post may contain explicit depictions of things which are "real".
These "real" things are commonly known as 'life'! So, if it sounds
sarcastic, don't take it seriously. If it sounds hazardous, Do not try
this at home or at all. And if it offends you, just don't read it.
Jul 17 '05 #2
I'm sorry, but this doesn't solve anything for me...
As you've probably noticed, i'm a newbie..

But anyway, what i can't figure, is why the doImage(); works
perfect, and the doFlash(); refuses to work..

What should i do then to fix it?

Thanks in advance..

Greetings knoak
Jul 17 '05 #3
knoak wrote:
Hi there,

I have a site with just a few pages. (e.g. home.php)
In every page there is another page included with things
like the header etc.

The included file is in a subdirectory called "include".
There are two functions written in this included file:

================================================== ========================= function doImage($image)
{
list($width, $height, $type, $attr) = getimagesize($image);
echo "<img src=$image width=\"$width\" height=\"$height\">";
};

function doFlash($Movie,$Height,$Width)
{
echo "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.c
ab#version=6,0,29,0\" height=\"$Height\" width=\"$Width\">
<param name=\"movie\" value=\"$Movie\">
<param name=\"quality\" value=\"high\">
<param name=\"allowscale\" value=\"true\">
<param name=\"SCALE\" value=\"exactfit\">
<param name=\"menu\" value=\"false\">
<param name=\"wmode\" value=\"transparent\">
<embed src=\"$Movie\" width=\"$Width\" height=\"$Height\"
menu=\"false\" wmode=\"transparent\" allowscale=\"true\"
scale=\"exactfit\" quality=\"high\"
pluginspage=\"http://www.macromedia.com/go/getflashplayer\"
type=\"application/x-shockwave-flash\"></embed>
</object>";
};
================================================== =========================
I call the functions from pages in the root directory, pages like
home.php...

When i call doImage("img/logo.gif"); it works well, but when i
call doFlash("swf/logo.swf","100px","100px"); It returns everything
before
the <html> tag starts, so it isn't in the right place either. When i
change
the "echo"-statement of doFlash() to "return" nothing happens and it
disappears in the source (online)

What am i doing wrong?

Hope someone can help...

Greetings knoakske


I really am surprised it doesn't work, I copy-pasted the function in my php
editor, and called the function with a local swf and it runs as expected. So
this leads me to believe the code itself is correct. Even if the .swf is
missing the page loads, allbeit it keeps looking for the missing
movieclip... Anything else you can think of that might be involved ? The way
the includes are handled ? The way PHP handles escaped chars or something ?
My PHP is a default setup, as it comes preinstalled with apache on my suse
9.0 linux machine.
(Apache 2.048 and PHP 4.3.3)

Sorry i can't be of more help.
Pjotr
Jul 17 '05 #4
Hi there, i'm running
PHP 4.3.3 on Linux, that's all i can figure out.

I'll re-explain the structure, maybe that's where it goes wrong..
_root -> home.php*, contact.php*, etc.*

folder "inc"-> standards.php, which also has the functions in it.
*in all the first line = include_once('inc/standards.php');)

I call the function in standards.php from home.php by the following
command: <?php doFlash("swf/logo.swf","100","100"); ?>

What i don't get is that the doImage() works fine in home.php.
The only difference is that doImage() has
"list($width, $height, $type, $attr) = getimagesize($image);"
before echoing something, could the flaw be somewhere in this part then?

Thanks in advance,

Greetings knoak
Jul 17 '05 #5
anyone?
Jul 17 '05 #6
knoak wrote:
anyone?

I'm sorry knoak, I can't reproduce it. I simply have no clue.
Pjotr
Jul 17 '05 #7
Crap!

Thanks anyway, i'll try something else then..

Greetings
Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Alessandro Crugnola *sephiroth* | last post: by
9 posts views Thread by Christian Christmann | last post: by
16 posts views Thread by mdh | last post: by
2 posts views Thread by sonaliagr | last post: by
8 posts views Thread by Viktor | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.