Announcement

Collapse
No announcement yet.

If image exists? [vb3]

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dani
    replied
    I believe what you are looking for is 'threadbit', and you can find the section you are looking for by finding the first occurence of 'member.php' (since you have the link to the profile of the thread starter)

    If this is not correct than please show me a link to the thread list that you wish to change!

    Leave a comment:


  • Kamex
    replied
    Ok then, one more thing. Do you know what the name of the template is that shows the name of the thread starter when viewing a forum? I want to put a member icon above it.

    Leave a comment:


  • Dani
    replied
    HeHe ... No problem there, see my dumb missing-the-partenthesis issue up there? I have been working with php for almost 3 years and see where I am?

    You can use HTML in vbphrases, however, I do not think it is possible to use <if> statements! (I am quite sure of this)

    Glad I could help out

    Leave a comment:


  • Kamex
    replied
    Announcing the world's biggest moron! That's right, he's right in this forum, come get his autograph!

    I was using /statusicon instead of /membericon. It works perfectly now.

    I'm so sorry you went through all that for nothing...thank you so much for helping me with this.

    Edit: Can vbphrases have HTML, and IF-ELSE statements in them? If so, I can save myself a lot of work by making the large bit of code for the image only once. Would this work?
    Last edited by Kamex; Fri 12 Mar '04, 3:15pm.

    Leave a comment:


  • Dani
    replied
    That's odd ... Can you verify the permissions and correct path of the dir you have placed the images and the img.php in? It has to work...

    Leave a comment:


  • Kamex
    replied
    Able to verify with file_exists
    Able to use readfile

    What on earn is going on here.

    Leave a comment:


  • Dani
    replied
    That I have no idea, try using this and tell me the results:
    (note, if it shows *unable*, there are workarounds, this is just to verify if these functions exist or are disabled)

    PHP Code:
    <?
    if (function_exists('file_exists')) {
            echo 
    'Able to verify with file_exists<p>';
    } elseif (
    function_exists('is_file')) {
            echo 
    'Able to verify with is_file<p>';
    } else {
            echo 
    '<b>Unable to verify with file_exists or is_file</b>p>';
    }
    if (
    function_exists('readfile')) {
            echo 
    'Able to use readfile<p>';
    } else {
            echo 
    '<b>Unable to use readfile</p>';
    }
    ?>

    Leave a comment:


  • Kamex
    replied
    Hmmm. Could my hosting company's server be missing some feature?

    I tried copying that. No luck.

    Leave a comment:


  • Dani
    replied
    This one I tested and improved a bit ...
    You can see it in vb.dmacedo.com/img.php (you can see the source and images)

    Userid=1 shows my avatar and any other shows a "dmacedo.com"

    PHP Code:
    <?
     
    // config

    // define here your relative or full path to the user images folder
    // note: no trailing slash is needed
    $path './images/statusicon';
     
    // default image name (must exist or image is shown broken)
    $default 'default';
     
    // end config
     
    $userid $_GET['userid'];
     
    if (
    file_exists("$path/$userid.gif")) {
        
    $img "$path/$userid.gif";
    } else {
        
    $img "$path/$default.gif";
    }
     
    header('Content-type: image/gif');
    @
    readfile($img);
     
    ?>

    Leave a comment:


  • Kamex
    replied
    I removed the @s. Nothing seems to be different, and I get no error message.

    I wonder if I'm doing it right.

    Leave a comment:


  • Dani
    replied
    Kamex, it's better that you remove the @'s before the readfile functions so it shows the error message, there must be one ... Else I am just guessing

    Leave a comment:


  • Kamex
    replied
    It still doesn't seem to work.

    Here's the code modified to work with my board:

    PHP Code:
    <?

    // config
    // define here your relative or full path to the user images folder
    // note: no trailing slash is needed
    $path './images/statusicon';

    // end config

    $userid $_GET['userid'];

    header("Content-type: image/gif");

    if (
    file_exists("$path/$userid.gif")) {
        @
    readfile("$path/$userid.gif");
    } else {
        @
    readfile("$path/default.gif");
    }

    ?>
    Here's a URL that comes up on the broken images. I won't hide anything this time so you can get the exact thing.

    http://theelectricuniverse.com/vb3/img.php?userid=37

    Leave a comment:


  • Dani
    replied
    Ooops ... Forgot to test it out! Seems like testing it in my brain does not work so well

    Missing one parenthesis, replace:

    PHP Code:
    if (file_exists("$path/$userid.gif") { 
    with
    PHP Code:
    if (file_exists("$path/$userid.gif")) { 
    That'll work now

    Leave a comment:


  • Kamex
    replied
    Oops, I forgot to mention that I tried to modify it to work with username. I tried this new version of it...unaltered this time, and I have the same problem. I decided to load the actual php file in my browser, and I get the following error:

    Parse error: parse error in <insert path here>/img.php on line 14

    I removed the path from the error message.

    Leave a comment:


  • Dani
    replied
    Hi Kamex,

    The PHP code above *is* the full source of the "img.php", but it might have confused you a bit, try this one and follow instructions:
    (also please note, you should use the USERID and not the username like in the example link you showed)

    PHP Code:
    <?
     
    // config
    // define here your relative or full path to the user images folder
    // note: no trailing slash is needed
    $path './images/userimgs';
     
    // end config
     
    $userid $_GET['userid'];
     
    header("Content-type: image/gif");
     
    if (
    file_exists("$path/$userid.gif") {
        @
    readfile("$path/$userid.gif");
    } else {
        @
    readfile("$path/default.gif");
    }
     
    ?>
    Next call it in the html template like this:

    Code:
    <img src="img.php?userid=$userinfo[userid]" border="0">
    If for some reason it still does not go ok, you can remove the @'s that are behind the readfile() function and see what error comes up! But I am sure that the problem should be the path where your images are located!

    Leave a comment:

Related Topics

Collapse

  • webcosmo
    Slider Image Resizing
    by webcosmo
    I have a situation where image resizing becoming an issue causing the whole image not being visible.
    Here is the url of a test case
    hairlossconnection.com/forums/forum/surgical-hair-restoration/photos-and-results/168-test-pictures...
    Thu 7 Mar '13, 3:07pm
Working...
X