On my site GAME.php page I have many photos in GIF format.
Is it possible that the user who connects to my site on the home page (index.php) downloads all my GIF images first? Like that when it goes to the page GAME.PHP the images will already download and they will be displayed directly.
If I put the images in a transparent div on the page INDEX.PHP, is that good?
But I find the idea not to be correct.
There are many solutions to the problem. One of the solutions is to include all the images in index.php and don't display them using css visiblility property. And load the game.php content using ajax and make the images visible. Problem with this solution is url's of two pages would be same. This won't be a problem if that is not a concern.
Related
I'm trying to create a photo upload system following Adam Khourys online tutorials.
http://www.developphp.com/view.php?tid=1395 - Upload multiple files video
http://www.developphp.com/view.php?tid=1304 - User profile upload
Most of the code is like for like, but with my own variable names used instead. One major difference is instead of creating 3 different file upload fields as in the multiple upload video I created my form to allow multiple selections from just one upload field.
Below is a brief overview of the files, their location and what the page does.
create_post.php located in root directory - the page that allows for image upload
image_uploader.php located in root > includes directory - the page that contains the upload form, made as a seperate file to be included into any page that may require photo uploads.
photo_system.php located in root > parsers directory - the page that handles image upload.
When I go to the create a post page, click the link to upload image(s) all works well, I can see the form, I can even select the files I would like to try and upload but when I click the upload button nothing seems to happen, when photo_system.php should load.
I've added a line of code to photo_system.php right at the top that should bring up an alert box once the page has loaded, in an attempt to debug my issues, but I never see this unless I go directly to image_uploader.php
This has lead me to believe that maybe my relative links to files were the issue so I've tried appending $_SERVER['DOCUMENT_ROOT'] to the start of the links to ensure it can alway locate them from the root directory, currently I have it set up with a hard coded $root variable and still I can't seem to get the system to work.
Is it likey that the file structure and the way the pages interact with each other is my problem? Could anyone take a look at my code for these three files and see if they can spot anything? I've been stumped by this for a week or so now so I think its time to ask for some outside help.
I have my 3 files saved in a txt format so the code can be viewed
http://www.vwrx-project.co.uk/temp_source_code/create_post.txt
http://www.vwrx-project.co.uk/temp_source_code/image_uploader.txt
http://www.vwrx-project.co.uk/temp_source_code/photo_system.txt
It turns out that in the end I was trying to nest two tables one inside the other so this was part of my issue.
The way that I had it set up I was including the photo upload system, image_uploader.php, as a table with an action requesting the photo_system.php file which worked when I went to the image_uploader.php page directly.
I also had in my main page where the images were being uploaded a form that had been set to onsubmit = false and this was canceling out the form action of the included file.
I only found this out when I decided to try and code it straight into one file else I'd still be stuck now.
By default when a webpage is loaded, images are loaded one single time for each image. If you have 5 instances of the same image on a page, that image is loaded once, and then used in all 5 places seemingly from the cache of the first image load.
What I want to do is have a single image displayed 5 times on a page, and each time the images is called have it re-loaded.
The reason for this is I have an image that is called from a database and each time the image is called it loads a different picture. Now this works perfectly when refeshing the page, but not when the image is loaded multiple times on the same page.
For example if I put the following into a webpage:
<img src='http://bannerpillar.com/u/viraladmin.jpg'>
The image loads perfectly. If I reload the page, a different picture is displayed for each time the page reloads. However if I add the image to a page in 2 different locations, the same one picture is displayed from both locations.
How can I make it so the image is refreshed every time it is called on a page? Is that possible?
Try adding something to the end of the file reference, like this:
<img src='http://bannerpillar.com/u/viraladmin.jpg?<?=rand(11111,99999)?>'>
The browser will think each image is unique and load each one separately rather than using the image from cache.
You can find a tutorial on this exact question here:
http://www.marcofolio.net/webdesign/php_random_image_rotation.html
Basically, in the src, you call a php file. The php file loads a filename from a directory of images.
For your case, you would need to write some logic to offset the database return, so this becomes a mysql question as well?
If you wanted the markup to call for an image file, you could redirect using a .htaccess rewriterule
Random no. generetion can be a good option.
but more better if you load those images serially i.e. one after another
n u can use looping for that.
Add a ?rand= to the image url.
<img src='http://bannerpillar.com/u/viraladmin.jpg?rand=<?php echo rand(100000,999999); ?>'>
I had trouble finding an answer for this problem. I would like to display a link to a page that has a video file on it but I don't want the link to appear until after the video file is uploaded.
It's a site where users upload videos so I don't want to have to manually put the links there for them after they upload their videos, nor do I want to make the links ahead of time since users will click them and there will be no video available.
So, is there a way to keep a link hidden until a file is uploaded. Once the file is uploaded the php page where the link will be on checks to see if it exists and then if it does the link is shown, otherwise the link stays hidden.
Each time the form that the client uses to upload a file is sent store the information of the file in a database.
Each time the client request the list of videos, query the database and build the web page based on the results.
Make sure to associate the uploaded files to the users, so you don't mix the up. Are you managing authentication already?
If you want to have the links appear as soon as the upload is finished without reloading the page, then you need ajax.
I am in the process of creating a site where visitors can preview(not THUMBNAILS!) another url on mypage in an input text box and click on"preview" button-
I am using CURL from php to extract the contents of the site
and have divided my page into two halves one for accepting url and the other half which will display the previewed content, basically i do not want image of the url site like GOOGLE.
though the CURL fetches me the contents and I am able to see the content on the preview half what is annoying is the CSS of the previewed html is getting applied across even my page :(
since my knowledge of css is very limited can anyone help me with the following
css of the previewed section must not get applied to my part of the page
How to scale down the previewed site just to fit into the preview section of my page.
thanks,
Jay
Use an iframe to keep the preview site separate from your own. Something like this should work:
<iframe id="preview" src="about:blank"></iframe>
<script>
function previewUrl(location) {
document.getElementById('preview').src = location;
}
</script>
i have a question to ask you. So I have on my webpage a showcase that has some images that keep playing. I used JCarousel to build it. The thing is that when i first enter on the page i can't see the image or I see only a part of it. I suspect that this is because the site a few seconds while it loads all the images it has. My question is: how can I make certain images be the first ones to be loaded? Or how can I prioritise the way the images load on the page? By the way I'm doing this in html,php using javascript and ajax and the images are taken from a database.
Thank you very much!
If you Base64 encode them, you can put them in the CSS, or HTML. It will really increase the side of a page, so perhaps encode a low resolution picture, and then replace it with highres when it loads. That is, a preview image.
Try this tool/guide.