Announcement

Collapse
No announcement yet.

Random Image works as direct link, but doesn't work in the IMG tag...

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

  • GamerZ
    replied
    ok here is my random image codes

    PHP Code:
    <?
    header 
    ("Content-type: image/gif");
    $images rand(1,5);
    include 
    "http://www.orientek.net/kore/gamerz/images/sigs/sig".$images.".gif";
    ?>

    Leave a comment:


  • wooolF[RM]
    replied
    f*ck it...

    I'm using other script

    Leave a comment:


  • wooolF[RM]
    replied
    hmmm... still talking to myself... maybe it will help in the end

    Anyway, here's updated version of my script that should at the output generate progressive JPEG with 100% quality.

    Code:
    <?php
    
    /* Location of the pictures */
    $logodir = "http://www.mpc.turbohost.net/wolfsig/";
    
    /* Type of output (for browsers) */
    header('Content-Type: image/jpeg');
    
    /* No caching (for newer browsers) */
    header('Cache-Control: no-store, no-cache, must-revalidate');
    
    /* No caching (for older browsers) */
    header('Pragma: no-cache');
    
    
    /* Making an array with all pictures */
    $logos = array
    (
        $logodir . "1.jpg",
        $logodir . "2.jpg",
        $logodir . "3.jpg",
        $logodir . "4.jpg",
        $logodir . "5.jpg",
        $logodir . "6.jpg"
    );
    
    
    /* explode = explode an array */
    /* microtime = return current UNIX timestamp with microseconds */
    
    function make_seed() {
        list($usec, $sec) = explode(' ', microtime());
        return (float) $sec + ((float) $usec * 100000);
    }
    
    /* explode	= seed the random number generator */
    srand(make_seed());
    
    
    /* rand = seed the random number generator */
    /* count = count elements in a variable */
    $logo = rand(0, count ($logos) - 1);
    
    /* Create image from predefined variables */
    $im = ImageCreateFromJPEG($logos[$logo]);
    
    /* Output image as a progressive JPEG */
    imageinterlace($im,1);
    
    /* Output image with 100% quality */
    Imagejpeg($im,'', 100);
    
    /* Destroy picture on the server */
    imagedestroy($im);
    
    ?>

    As always... Script is working but there's some problems with it : generated pictures are not in the same quality as input pictures.

    Leave a comment:


  • wooolF[RM]
    replied
    got this script to work : ( credits for helping goes to [email protected] )
    Code:
    <?php
    $logodir = "http://www.somewhere.com/pics/";
    
    header('Content-Type: image/jpeg');
    header('Content-Disposition: inline; filename=file.jpg');
    header('Cache-Control: no-store, no-cache, must-revalidate');
    header('Pragma: no-cache');
    
    $logos = array
    (
        $logodir . "1.jpg",
        $logodir . "2.jpg",
        $logodir . "3.jpg",
        $logodir . "4.jpg",
        $logodir . "5.jpg",
        $logodir . "6.jpg"
    );
    
    function make_seed() {
        list($usec, $sec) = explode(' ', microtime());
        return (float) $sec + ((float) $usec * 100000);
    }
    srand(make_seed());
    
    $logo = rand(0, count ($logos) - 1);
    
    $im = imagecreatefromjpeg($logos[$logo]);
    Imagejpeg($im);
    imagedestroy($im);
    
    ?>
    now the problem is : all 6 pics I used was 25-30kb in size in perfect quality. After randomizing by this script all I get is blurred, low quality picture 8-9kb in size...

    are there any ways to be sure that qulity at the end is the same as in the start?

    Leave a comment:


  • wooolF[RM]
    replied
    Originally posted by wooolF[RM]
    hmmm... will try this one:

    http://www.vbulletin.com/forum/showt...t=random+image

    still... I want to know what's wrong with my code, so please if you can see the problem, show me Thanx again

    doesn't work...

    Leave a comment:


  • wooolF[RM]
    replied
    hmmm... will try this one:

    http://www.vbulletin.com/forum/showt...t=random+image

    still... I want to know what's wrong with my code, so please if you can see the problem, show me Thanx again

    Leave a comment:


  • Random Image works as direct link, but doesn't work in the IMG tag...

    Hello everyone... I used following script to push a random picture:
    Code:
    <?php
    $logodir = "http://www.somewhere.com/pics/";
    
    header('Content-Type: image/jpeg');
    header('Content-Disposition: inline; filename=file.jpg');
    header('Cache-Control: no-store, no-cache, must-revalidate');
    header('Pragma: no-cache');
    
    $logos = array
    (
    	$logodir . "1.jpg",
    	$logodir . "2.jpg",
    	$logodir . "3.jpg",
    	$logodir . "4.jpg",
    	$logodir . "5.jpg",
    	$logodir . "6.jpg"
    );
    
    function make_seed() {
        list($usec, $sec) = explode(' ', microtime());
        return (float) $sec + ((float) $usec * 100000);
    }
    srand(make_seed());
    
    $logo = rand(0, count ($logos) - 1);
    $titleimage = $logos[$logo];
    ?>
    
    <?php
    echo "<img src=$titleimage>";
    ?>
    Then I saved that script as sig.php and uploaded in the same folder where pics are. Then I checked http://www.somewhere.com/pics/sig.php and it worked like a charm...

    Now... I went to my VBB forum and made a new VBB code :

    vB Code tag
    adminimgonly

    vB Code replacement
    <img src="{param}">

    vB Code example
    [adminimgonly]http://www.google.com/images/logo.gif[/adminimgonly]

    vB Code explanation
    Adds an IMAGE to a signature for ADMINS only.

    Use {option} ?
    Yes No

    And tried it out in my signature as
    Code:
    [adminimgonly]http://www.somewhere.com/pics/sig.php[/adminimgonly]
    . Do u think it worked? nope!
    But direct access
    Code:
    [adminimgonly]http://www.somewhere.com/pics/1.jpg[/adminimgonly]
    to the picture worked fine (just showing that this vBB code works perfectly)

    In the source code I could clearly see plain html language
    Code:
    < img src="http://www.somewhere.com/pics/sig.php" >
    which should work but didn't (showed only place for the pix with X in the top left corner of it)

    Anyone have any ideas?


    PS:

    I have also tried this code:
    Code:
    <?php
    $logodir = "http://www.somewhere.com/pics/";
    
    header('Content-Type: image/jpeg');
    header('Content-Disposition: inline; filename=file.jpg');
    header('Cache-Control: no-store, no-cache, must-revalidate');
    header('Pragma: no-cache');
    
    $logos = array
    (
        $logodir . "1.jpg",
        $logodir . "2.jpg",
        $logodir . "3.jpg",
        $logodir . "4.jpg",
        $logodir . "5.jpg",
        $logodir . "6.jpg"
    );
    
    function make_seed() {
        list($usec, $sec) = explode(' ', microtime());
        return (float) $sec + ((float) $usec * 100000);
    }
    srand(make_seed());
    
    $logo = rand(0, count ($logos) - 1);
    
    $im = imagecreatefromjpeg($logos[$logo]);
    Imagejpeg($im);
    imagedestroy($im);
    
    ?>
    no luck
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X