WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Using PHP im HTML image tags
Categories : PHP, HTML and PHP, Graphics, Beginner Guides Click here to Update Your Picture
John Risken
Date : Sep 11th 2008
Grade : 1 of 5 (graded 3 times)
Viewed : 8365
File : No file for this code example.
Images : No Images for this code example.
Search : More code by John Risken
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

A simple example that allows images to be included in HTML without being in the web site's file path

I’ve looked in a pot-full of forums for the answer to this question:
How can I get the ‘src’ parameter of an HTML ‘img’ tag to refer to an image that is not in the web site’s path? I wanted to be able to do this so that images could be more secure and wouldn’t need to be replicated for multiple subdomains.

What I finally pieced together is very straightforward: the seeds of it were in several places, but here’s a working model all in one place.
(By the way, this has been tested with Fireefox, IE7, and Chrome. My web site runs under PHP 5 on an Apache server.)

I decided to keep my images in a folder called ‘help’ that is at a peer level with ‘public_html’. In ‘help’ I have another folder called ‘sample’

Here’s the original image tag: <img src=”sample/myPicutre.jpg”>

Here’s the modified tag: <img src=”index.php?helpimage=sample/myPicture.jpg">

Here’s how my modified index.php file looks

index.php
<?php
extract
($_GET); // will contain the ‘helpimage’ variable
if(isset($helpimage)) // if this is a call for an image
{
   
$f=pathinfo($helpimage); // and if its an actual image file (hacker-resistance)
   
if($f['extension']=="jpg")
    {
       
chdir("../help"); // jump up  one level to the help folder
       
readfile($helpimage); // and send the image back to the browser.
       
return; // that’s it
   
}
}
?>


… whatever else index.php is supposed to do



Real simple example of removing HTML tags from text then changing \n (new line) to <br>. Could be used in a forum for instance.
Categories : HTML, PHP, HTML and PHP, Beginner Guides
Multiple Select box, Select multiple Items from Menu.List box
Categories : PHP, HTML and PHP, Beginner Guides
Newbie Notes #1 - Making a form return to itself
Categories : PHP, Beginner Guides, HTML and PHP
Simple PHP/3 Access Counter (using GD and DBM functions)
Categories : Databases, PHP, Graphics, HTML and PHP, dBase
mySQL/PHP/search with multientry form and table output with colored rows
Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases
PHP Email image generator - hide your email from bots - using the GD Library
Categories : PHP, Graphics, GD image library, Beginner Guides
PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use!
Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP
Creating thumbnails from MySQL Blobs online
Categories : PHP, MySQL, Graphics, HTML and PHP, Databases
Functions for loading images into a MySQL database and displaying them.
Categories : Graphics, HTML and PHP, MySQL, PHP, Databases
Form Submission Using Array's
Categories : PHP, HTML and PHP, Beginner Guides, Arrays
Random Image Display
Categories : PHP, Filesystem, Graphics, HTML and PHP
Simple PHP Form Field Generator
Categories : PHP, Beginner Guides, Form Processing, HTML and PHP
How to Create a Shoutbox Using PHP & MySQL
Categories : PHP, MySQL, Web Applications, Beginner Guides, HTML and PHP
Simple image counter
Categories : PHP, Graphics, Filesystem, Beginner Guides
Snipe.Net's Web Design Color Scheme Previewer- Allows uses to input hex codes for their text, background, and link colors, and preview the color scheme with their background image. Example: http://www.snipe.net/tech/snipeschool/hex.php3
Categories : PHP, HTML and PHP, General, Graphics, HTML