CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 What's wrong with this function?

Print topic Send  topic

Author Message
Donna
Posted: 03/28/2002, 10:31 AM

Hi! I'm expanding on the gallery application so that the uploaded photos will never be displayed larger than my design allows. I have it working but wish to expand on it even further. I have to sets of code below. The first is where I have attempted to create a function (which does not work). The second is the working code that is not in function form. Can anyone tell me why the function doesn't work?

//start function code
if ($fldlocation!=null) {
$username = dlookup("users","name","user_id=".get_param("user_id"));
$tmpfile = "users/".$username."/".$fldlocation;
}
else {
$fldlocation="No image available";
}
//The following line WILL produce the correct path.
$fullview = "http://www.mysite.com/gallery/users/".$username."/".$fldlocation;

$fldwidthsize = "The actual size of this image is $fldwidth X $fldheight (pixels)";

$fldfullsize = "<A href='" . $fullview . "'>View full size";

//Change Image Width and Height if too big for screen
function myvarA() {
if ($fldwidth > 350 AND $fldheight > 400 AND $fldwidth > $fldheight) {
$fldlocation = "<img src=$tmpfile width=350>";
}
elseif ($fldwidth > 350 AND $fldheight > 400 AND $fldwidth <= $fldheight) {
$fldlocation = "<img src=$tmpfile height=300>";
}
elseif ($fldwidth > 350 AND $fldheight <= 400) {
$fldlocation = "<img src=$tmpfile width=350>";
}
elseif ($fldwidth <= 350 AND $fldheight > 400) {
$fldlocation = "<img src=$tmpfile height=400>";
}
else {
$fldlocation = "<img src=$tmpfile>";
}}

myvarA()
// end function code

The code below works correctly, but again I'm trying to convert it to a function for further expansion.

//start working code located in the before show properties of my form
if ($fldlocation!=null) {
$username = dlookup("users","name","user_id=".get_param("user_id"));
$tmpfile = "users/".$username."/".$fldlocation;
}
else {
$fldlocation="No image available";
}
//The following line WILL produce the correct path.
$fullview = "http://www.mysite.com/gallery/users/".$username."/".$fldlocation;

$fldwidthsize = "The actual size of this image is $fldwidth X $fldheight (pixels)";

$fldfullsize = "<A href='" . $fullview . "'>View full size";

//Change Image Width and Height if too big for screen
if ($fldwidth > 350 AND $fldheight > 400 AND $fldwidth > $fldheight) {
$fldlocation = "<img src=$tmpfile width=350>";
}
elseif ($fldwidth > 350 AND $fldheight > 400 AND $fldwidth <= $fldheight) {
$fldlocation = "<img src=$tmpfile height=300>";
}
elseif ($fldwidth > 350 AND $fldheight <= 400) {
$fldlocation = "<img src=$tmpfile width=350>";
}
elseif ($fldwidth <= 350 AND $fldheight > 400) {
$fldlocation = "<img src=$tmpfile height=400>";
}
else {
$fldlocation = "<img src=$tmpfile>";
}


Thanks,
Donna
Donna
Posted: 03/28/2002, 12:31 PM

I should have said this earlier, sorry:

I don't receive any errors regarding the function, but, now my field "location" no longer displays the actual image but rather the file name. I can't seem to fiqure out why.

Thanks again.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.