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 : Popup window creator for images on the Fly.
Categories : PHP, GD image library, Java Script Click here to Update Your Picture
Mian Shafiq ur Rehman
Date : Dec 13th 2004
Grade : 4 of 5 (graded 18 times)
Viewed : 10169
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Mian Shafiq ur Rehman
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

Title : Popup window creator for images on the Fly.
Version: 1.0.0
Author: Mian Shafiq-ur-Rehman
Email : gurru@phpgurru.com
Mess : rehmanms@hotmail.com
Website: www.phpgurru.com

This program creates popups after calculating the Height and Width of image and
shows image in popup window according to the Height and Width.

<script language="javascript">
function loadWindow(imgPath,width,height) {
    var msgWindow = window.open("","Window_" + Math.floor(Math.random() * 10000000), "width=" + width +",height=" + height +"");
    msgWindow.document.write("<html>\n<head>\n<meta http-equiv='Content-Type' content='text/html; charset=windows-1256'>\n<title>Picture preview</title>\n</head>\n<body>\n");   
    msgWindow.document.write("<table width='100%' height='100%' border='1' cellpadding='10' cellspacing='5' bordercolor='#0066FF'>\n<tr>\n<td align='center' valign='middle'>\n");
    msgWindow.document.write("<img src='" + imgPath +"'>");
    msgWindow.document.write("</td></tr></table></body>\n</html>\n");
    msgWindow.focus();
}
</script>

<?php
/*
I have uploaded the zip file in whoick complete code the written with images.
*/
function popup_window($imgPath)
{
    if(
file_exists($imgPath))
    {
       
$size= @getimagesize( $imgPath );
       
$width=$size[0];
       
$height=$size[1];
       
$width = ($width < 200 ? 250 :  ($width + 50));
       
$height = ($height < 300 ? 350 :  ($height + 50));
       
$popup= "<a href='#' onClick=\"javascript:loadWindow('". $imgPath ."', " . $width . ", " . $height .");\">View Image</a>";
        return
$popup;
    }
}
?>



Pass complete path of image to my routine and it will display a Link ~View Image~. On clicking this will open a new popup window according to the size of image. Kepp in mind that your popup blocker is turned off.

Usage Example
<?php
echo popup_window("1.jpg") . "<br>";
echo
popup_window("2.jpg") . "<br>";
echo
popup_window("3.jpg") . "<br>";
echo
popup_window("4.jpg") . "<br>";
?>



PHP Email image generator - hide your email from bots - using the GD Library
Categories : PHP, Graphics, GD image library, Beginner Guides
PHP Array to Javascript Object
Categories : PHP, Arrays, Java Script
Builds JavaScript that updates the contents of one selector based on another.
Categories : HTML, Java Script, PHP, Complete Programs, General
PHP Image Class
Categories : PHP, PHP Classes, Multimedia, GD image library
Create HTML forms dynamicly using Javascript & PHP
Categories : PHP, PHP Classes, Java Script
Local Time clock and Server time usign PHP and JavaScript
Categories : PHP, Java Script, Date Time, Beginner Guides
Image Browser
Categories : Filesystem, GD image library, Content Management, PHP
Remote Scripting: send form POST data to a script and insert the results into a page without refreshing the page.
Categories : PHP, AJAX, HTML and PHP, Java Script
PHP3 generated gif / javascript mouseover.
Categories : PHP, Java Script, MySQL
A damaged image generator (class) for validating text. CAPTCHA - Completely Automated Public Turing test to tell Computers and Humans Apart
Categories : PHP, PHP Classes, Security, GD image library, Security
Alert in JavaScript and Trace in Flash Action script are two commands that I find very much useful for tracking and debugging errors in my scripts. Unfortunately, there is no such option in PHP.
Categories : PHP, Java Script, Debugging
A simple configuration file editor to ease you life in setting up php applications. Reads variables from a given file automatically and displays current value. New value will be written to file after submit.
Categories : PHP, Filesystem, Regexps, Java Script
Display a bar chart based on random values.
Categories : Graphics, PHP, GD image library, Charts and Graphs
PHP4 session helper HTML file.
Categories : PHP, Java Script, HTML and PHP, Sessions
Local-to-user date and time display regardless of time zone or where the website's server is located
Categories : PHP, Date Time, HTML and PHP, Java Script