•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 330,317 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,830 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
This code will display images within an email from the server. It will display an image with a choice of file extension which can be expanded to fit your needs.
this code was originally developed for a emailing system where the images to be displayed where uploaded by the user.
this code was originally developed for a emailing system where the images to be displayed where uploaded by the user.
$image = ""; $broad_img1= ""; //this has to be set like this as if file exist does not work with absolute paths $path= 'http://wwwyour web site.com'; //this is the directory where the images are stored $web_image_folder = 'image/thumbs'; $exts = array('jpg', 'png', 'gif', 'jpeg'); //the name of the file on the server $image_name = 'thumb_image1'; // check for each extension foreach($exts as $ext) { if (file_exists($web_image_folder.'/'.$image_name.'.'.$ext)) { $image = $image_name.'.'.$ext; } } // check if we have an image if ($image != "") { // ok we have the image now store it in a variable $broad_img1='<img src="' . $path."/".$web_image_folder."/".$image . '" />'; } else { // error, we can't find the image. }
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)