Random Background Image
I'm designing a site that needs to do the following: Select randomly from a series of about 5 different background images Store the selected image name in a session variable I'm pretty sure that I can setup it's selecting randomly from images and storing it in a session variable. The thing I can't figure out is how I should execute it most efficiently. Will it work to do a php file include of the php file that has the code.
View Complete Forum Thread with Replies
Related Forum Messages:
Random Background Image + CSS
I have images stored in a server folder with metadata in Database. The images are to be used as Background Images set in a .CSS file... background: #fff url('../images/main_bg.jpg'); How do I display images by random in the CSS file? Is it possible?
View Replies !
Random Background In PHP
Not sure if this can be done in PHP but I'm looking at giving users an option to choose a background image from a list ie when they click on a url it changes. If you click on the links to change of scene on the left hand column, you'll hopefully see what I mean. Can this be done in PHP? I've tried googling it, searching on various forums but can't seem to find anything..
View Replies !
Random Text & Background Colors?
Is there a way to generate colour hex strings that are guaranteed to be dark and thus good as random-generated text colours? something like ------------------- srand((double)microtime()*1000000); function tc() { $frag = range(0,6); $text = "#"; for ($i = 1; $i <= 6; $i++) { $text = $text . $frag[mt_rand(0, count($frag)-1)]; } return $text; } $text = tc(); -------------------- is what I have in mind.... but I really don't know how the hex codes for rgb realte to "darkness" And while I'm on the subject, whats the converse (for pale colours, for backgrounds) look like?
View Replies !
Background Image
i created a calendar in php. i have this calendar displayed on another php page (index.php). i added a background image to the calendar. it displays fine on the calendar alone but it won't display as a background image when i display it on index.php.
View Replies !
Background Text Image
How can I place text on a page like a watermark background. For example, I may want to put FOR SALE in large red letters in the center of a page at a 10% opacity then write text over it from the initial point of origin. I've tried using style commands, but the results are inconsistant.
View Replies !
Text On A Background Image
it needs to have the background of another image (bg.jpg) and then have text printed on top of it. I have tried jpgraph but it was to hard to understand then i tried this:   <?php         header ("Content-type: image/png");         $img_handle = ImageCreate (230, 20) or die ("Cannot Create image");         $back_color = ImageColorAllocate ($img_handle, 0, 10, 10);         $txt_color = ImageColorAllocate ($img_handle, 233, 114, 191);         ImageString ($img_handle, 31, 5, 5,  "My first Program with GD", $txt_color);         ImagePng ($img_handle);  ?>
View Replies !
Background Image Load Problem
I have a table with a large background image: <table style='background-image: url(images/eagle_country_large.jpg); ..'> The problem is that everything on the page loads except there is a big delay with the loading of the image. It's not like a regular image loading. Somehow it looks like the page is finished, then a delay, and then the background picture appears. It's even worse on a dialup connection. Code:
View Replies !
Question About Adding A Background Image
I have searched and dug and I have looked at probly every thread on hear and I have still not been able to figure out how to put up a simple background image I have tried a couple things from different threads but when I enter in the code I either get light blue background, no page at all, or the same as what I started with. Here is what I am adding (with many variations) <body style="background: #CCFFFF url('../../images/adrian18.jpg');">' It works fine in my editor (dreamweaverMX) but when I upload it I get nothing. Please treat me like I am Stupid, the reason is because I don't know for sure If I have been editing the right file. the file I have been editing is index.tpl under my /templates/ folder, because it sets my layout, I do also have a index.php in my root folder.
View Replies !
Image Create Default Background Color
I have a script that crops and image and resizes it, but that's not the problem. If the image is smaller than the crop area, PHP just fills it in with black. Is there a way to make PHP fill it in with white instead of black?
View Replies !
Random Image?
is there a way to give one address..and it would display a random image out of a set amount? like, i wanted 2 images to be randomly displayed..how would i do that? useing one address...
View Replies !
Random Image Gen
I have tried this with 6 different codes I have found on the net. Everytime I just get a broken image and never displays a picture. Is there something else I need to do other than adding in the PHP code. For example, are all websites setup to run PHP or is there something I need to setup before?
View Replies !
Random Image
locating a PHP script that displays a random PNG image from a set directory. The script must produce a PNG file, such as image.png, to link to as opposed to only an image.php (for use on forums where the PHP extension is prohibited for images).
View Replies !
Random Link/image
I'm looking for a good random affiliate script,i'm not really going to use it for my affiliate i wanted use have a random image come up everytime you load the page and once click it should take you to a page of your choice,I have a good javascript one but sometimes the iframe where i have the script in comes up as undefined.Is their any simple php scripts that can do the job?
View Replies !
Random Image Script
I need a nice randmom image script that will also let me call a particular image with an url like random_image.php?=207 and show a php header and footer with the image. Where could I find a script that will do this?
View Replies !
Picking An Image At Random?
I have a directory with hundreds of pictures, of all varying names. And I want to display a random picture from the directory on every visit. Does anyone know of a quick way to grab a random file from a directory?
View Replies !
Random Validation Image With Gd2
i wondered if it could be possible (well it is but how?) to make the image generator output a temporary png in a tmp dir and then parse this string to the form so the browser can load the image?
View Replies !
Random Image W/ PHP5
My server host just upgraded to PHP5 and mySQL5. Unfortunately this means it broke a few scripts that were working so I need a new method to get the same effect. I was using rid.php (random image script) that was fairly simple. I drop it into a directory with images, then link to it and it will pull the images up in the directory. There was never any need for me to update the script when I added images, I just needed to add the images to the directory. Code:
View Replies !
Random Image Code
Could someone please tell me what I need to change or add to allow this script to display a new image weekly instead of every time the page is refreshed? <? // Connect to the database mysql_connect ('localhost', 'username', 'password') ; mysql_select_db ('database_name'); // Edit this number to however many links you want displaying $num_displayed = 3 ; // Select random rows from the database $result = mysql_query ("SELECT * FROM links ORDER BY RAND() LIMIT $num_displayed"); // For all the rows that you selected while ($row = mysql_fetch_array($result)) { // Display them to the screen... echo "<a href="" . $row["link"] . ""> <img src="" . $row["image"] . "" border=0 alt="" . $row["text"] . ""> </a>" ; } ?>
View Replies !
Random Image Rotator
I found random PHP slideshow script... but can't find where PHP can set up an array with n images and one and only one url for each rotatated image... can PHP do this? Or am I stuck with Java? Or what? automated script in html code for image rotate... url link also array has images and url for link automated pulls image and link from array random and non-repeating.... once per page view. Steer this ship. PHP or Java?
View Replies !
Display Random Image
i have code to display an image in 1 directory, does anyone have something that will search all sub dirs within the root tree say main humor weird etc but it will scan them all, i have about 80 sub dirs, i dont wanna put in an array.
View Replies !
Selecting Random Image
Is there a way to select a completely random image or something similar to that from the database, I know you can do LIMIT 0, 1 but I want it to be random, is this possible?
View Replies !
Update Random Image
i am ask to write a random genrator which will select the random image and change after every hour. i already create a bit program to get ramdom image but i have problem to rfreah the image after very hour.
View Replies !
Simple Random Image
I am trying to make a simple .PHP code that will create a random banner in 1 location I put all the picture/link info in a table in my MYSQL DB.. And now I just ned a simple .PHP code that will create 1 random image at single location. Hope this makes sense! I did something like this before except it involved using several images and was also for my vbulletin forums. I am just trying to create something for a regular .PHP website. Code:
View Replies !
CSS And Random Image Question?
This is a two part question. First part: CSS wont work if used in my page when a linked CSS file is used already? If I cut out a section of the CSS and paste it in my document it doesn't work. Second part: How to get random images based on CSS value entries? Currently am using different CSS files for different pages. Page_one.php => page_one.css attached. Page_two.php => page_two.css attached. This is not the way I prefer to code my sites. How to fix?
View Replies !
Random Image/sign Up Code >.<
Ive noticed several sites using php to do this image to show a sign up code. This sign up code is sent to your email address to make sure it is a working email addreess. THen in the email, there is a link that uses the sign up code to validate and stuff. So my question is, how do i make my own little sign up code image so that the person signing up will be given a random set of numbers and characters.
View Replies !
Random Image From MySQL Query
in mysql engine 3.23.** and above, I can use this query : SELECT * FROM tablename WHERE clauses ORDER BY RAND() LIMIT 1 but when I use mysql engine 3.22.** and below, the query does not work, does anyone have any trick to have the random result ?
View Replies !
Choose Random Image From Dir And Display It
I have a directory of images, called "random". In it are the following files: 1.gif 2.gif 3.gif 4.gif I use this script to choose a random image and display it: $i = -2; // $i = -2 so that the directory files ("." and "..") won't be counted. if ( $dh = opendir( "images/random" ) ) { while ( false !== ( $file = readdir( $dh ) ) ) { $i++; } closedir( $dh ); $rand = rand( 1, $i ); $randimg = '<img src="images/random/' . $rand . '.gif" />' } print $randimg; This works just dandy. However, I figure there must be a more efficient way to count the number of files in a directory. Is there a directory's equivalent of a function like file()? Or is my script the only way to count the files?
View Replies !
Random Image From SQL Databse Problem
I currently have a form to upload an image to a directory and another page that randomly displays the pictures. However, right now the PHP code I have displays them randomy from the directory. I want it to randomly receive it from one of the SQL fields that are in one of the tables. When someone uploads an image i currently save the link of where the image is to a table. My current PHP code for the random image is:...
View Replies !
Random Image Stop Duplicates
i am trying to create a homepage with random images and data displayed... e.g the items picture and price.... i have managed now to do this but i get duplicates how can i stop this.. Code:
View Replies !
Random Image W/link Generator
I have a webpage which uses javascript to generate 5 random images from a given array in a folder (images) It gets to be a pain when whenever I add an image to the folder, I also have to update the array an upload the page again. I was there a way to have this effect using php so that it will always choose random pictures from the folder (even if its updated) and would print that image (img01.jpg) and link it to a wmv video file (img001.wmv) (notice: the only difference between the 2 files are its exension, *.jpg and *.wmv)
View Replies !
Random Auto Image Rotation
I am trying to find a script, or write one, that will randomly display a different image from a folder, similar to this script below, only i need the script to refresh only the images and not do a meta refresh, is this possible? I know javascript can do it, but I would like to stay away from client side code as much as possible. PHP Code: <script language="php"> // ============================================================= // Script:Â Â Â Â Image Rotation Script //Â Â Â Â Â Â Â Â Â Â Â Â With Adjustable Timing and Unlimited Images //Â Â Â Â Â Â Â Â Â Â Â Â Utilizes META REFRESH // Function:Â Â Displays random images continuously in a slideshow //Â Â Â Â Â Â Â Â Â Â Â Â presentation format // PHP ver:Â Â Â 3.x, 4.x // Author:Â Â Â Â Jarrod Major // Email:Â Â Â Â Â jarrod@nucleus.com // Copyright: (C)2001 Nucleus Information Service Inc. // Licence:Â Â Â Free, drop me a line letting me know where you //Â Â Â Â Â Â Â Â Â Â Â Â used the script. Please keep this header attached. // =============================================================
View Replies !
In Background
Here's my situation. I'm creating a website (basically a store) and in the admin section users will want to download zip files of images or products added in the last 7 days, last 2 weeks and the last month. I have scripted a cron to run every 24 hours to zip all the images and this process takes over 1 minute (there's over 6,000 images!!) and the size of this is 250MB. This has now taken me to my quota on my webspace of 500MB (including all the individual images) I have decided the only way to do this is dynamically create the zip when the user requests it. As PHP times out after 30 seconds it needs to do it's stuff in the background and display a message saying something like' We'll email you with the zip file in 5 minutes or so'.
View Replies !
Run In The Background?
I have a script on my website that takes a long time to run, and it's slowing down my pages. Theres nothing I can do about the wait time on the file. Is there a way to use include or fopen or anything along those lines, to have it execute my file in the background; without having the file that's executing it waiting for it to finish its thing? Or to have the expected output redirected to another file (as mentioned in http://ca3.php.net/manual/en/function.exec.php)?
View Replies !
Running Background Job...
Is it possible to get a php3 script to check what day it is, and then do some stuff, If it’s let’s say Monday? This without you doing anything. Like a background - or cronjob… I guess you would use perl or something to do this, but that is not an option I have.
View Replies !
Background Processing
What is the technique you use for background processing? Like when user submit a task, the user could then wait for the result by email or through a result page. I'm wondering how would they do that?
View Replies !
Background Color
I am totally baffled by what is happening in my code. I have a section of code (shown below with two comment lines inserted). They are essentially identical text boxes (names and variables different). Yet, the first comes up with a white background and the second comes up with a yellow/gold background....
View Replies !
Run Process In Background
I want to run process from my php script in background. I try different functions from functions list but all of them whaiting for process ending. How can I run `wget -b ...` and finish my script, but wget must still working? I use PHP5, Linux, Apache2.
View Replies !
Background Processes
I'd like to know how to send an external process to the background, so that I can run multiple instances of the same process at one time. Any tips, links.. etc?
View Replies !
Running Php In The Background
I am trying to run a php executable (GTK) from a browser... now exec() does the job, but the browser hangs waiting for the .exe I have just called to finish, I assume so it can 'report back' to exec(), any ideas how I can get around this ? - I have tried backticks,passthru,system,exec - all with the same results, i.e. they all expect a returned value and sit around waiting for it. This is a windows app so /dev/null wont help & it is not a CGI with output I can dump anyway.
View Replies !
Run A Php In The Background Using Http
i have a script (script1) which needs to call another script (script2). It should not wait for the answer, so script2 should run in the background. I really need to call the php script using: http://urlof myscript/script2.php I don't want to use it as a cgi and use CLI. I did a test with fsockopen and curl and a timeout of 10 seconds and call http://urlof myscript/script1.php from my browser: Script1 stops after 10 seconds => OK Script2 has been called by script1 and continue to run in the background =>OK After 60 seconds Script2 is killed by php!! => KO :( The script is working fine if i call http://urlof myscript/script2.php from my browser. It needs around 120 seconds to finish. Why is it stopping after 60 seconds when I use fsockopen and call it from script1? Here is the script in SCRIPT1: $fp = fsockopen("$host", 80, $errno, $errstr, 30); stream_set_timeout($fp,10); if (!$fp) { echo "$errstr ($errno)<br /> "; } else { $out = "GET $path HTTP/1.1 "; $out .= "Host: $host "; $out .= "Connection: Close "; fwrite($fp, $out); $status = socket_get_status($fp); while (!feof($fp) && !$status['timed_out']) { echo fgets($fp, 128); $status = socket_get_status($fp); } fclose($fp); } I have added this in SCRIPT2: ignore_user_abort(FALSE); // becareful, FALSE really means it should ignore user abort !!! set_time_limit (120); ini_set("max_input_time",120); ini_set("max_execution_time",120); Do you have any idea?
View Replies !
Background Refresh
I am using php_move_file to upload some files to the server. I want to be able to support large files. But the Apache settings is that after 90 sec. the connections resets. This becomes a problem with large files (slow links). Is there anyway to write a script that would refresh in the background....
View Replies !
A Way To Get Current Background?
I have several websites running on a global script. Some pages, the backgrounds black, other, white. Sometimes people have the taste of posting black font on a black background, or white font on a white background. What I wanted is to know if theres a way to 'check' the current background color? Because I can then add in the script to 'change' any incorrect colors before posting. I'm not sure if theres a way for PHP to tap into CSS and check, but it would be alot easier to change the global script since its *Checking* for the background color rather then me do it per site and change it manually.
View Replies !
Background Redirection
I need to create a redirection from a php page to another, without having a web browser opened. Imagine that you make a php starting via command line or cron job, then your php is running in background and no web browser is open on it. How can this php (from the background, with no web browser opened) call (trigger) another php? please note that I'm not talking about include. I need that the background php gives control to ANOTHER php url . per what I tested the php 'header' command does not work and obviously also any javascript redirection cannot work because there is no web browser opened. so, finally, how can that php running in background call another php url?
View Replies !
Using SWF Files As Background
Im not sure if it posilbe, but im trying to get a SWF file as the background of my page, but the swf file is dynamically named. Its like a gallery and when a user clicks on the lick to that file, it displays the image /swf. but i want the file to appear as the background. code: echo "<body background = '".$POST['file_name']."'>"; ii have 3 files so far. file1, 2, 3 .swf. and i can easily view each one as a seperate file, and they work once i embed them as images. is this my php code, or do i have to look at my browser to display the swf as BG..?
View Replies !
|