0

I have a drop shadow function in PHP.

In my php page, I have HTML set up like this:

 <img src="<?php echo drpShadow($img_path[$i]);?>" />

The php function is like this:

     function drpShadow($pic_url){ echo "Hello";
    list($width, $height)=getimagesize($pic_url);
    $pic_display="<table border='0' style='display:inline;' cellspacing='0' cellpadding='0'><tr><td width='4px' height='$height'><img src='/SV/Graphics/drop_shadow_top_left_corner_4x4.jpg'><br>";
    for ($i=0; $i<($height-4); $i++){
        $pic_display.="<img src='/SV/Graphics/drop_shadow_left_4x1.jpg'><br>";
    }
    $pic_display.="</td><td width='$width' height='$height'><img src='$pic_url'></td></tr><tr><td colspan='2' height='4px' width='($width+4)'><img src='/SV/Graphics/drop_shadow_left_bottom_corner_4x4.jpg'>";
    for ($i=0; $i<=($width-6); $i++){
        $pic_display.="<img src='/SV/Graphics/drop_shadow_bottom_1x4.jpg'>";
    }
    $pic_display.="<img src='/SV/Graphics/drop_shadow_right_bottom_corner_4x4.jpg'></td></tr></table>";
    return $pic_display;
}

This function doesn't get called because the echo "hello" doesn't show up.

How should I solve this?

Thanks

1
  • How does the rendered img tag look like? Commented Nov 27, 2009 at 22:25

1 Answer 1

3

Because you are putting function output into src tag? You would have something like this:

img src="Hello table border..."

Check in page source, you should see hello there ;)

Sign up to request clarification or add additional context in comments.

2 Comments

yes, you are right... source says "%etc table etc etc "... How can I solve this then?
you should ommit img tag becouse your function creates html already (including src tags as I can see). So try simply <? echo drpShadow($img_path[$i]); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.