Reply to Re: How do I retrieve images dynamically based on the login username?

Your name:

Reply:


Posted by meltedown on 11/17/05 21:38

FayeC wrote:
> I have created a site in Joomla with a login (no self registration,
> users are provided with username and password by the admin).
> The users are supposed to login to a specific page where they can see
> 4 images.
> I have the following code:
> <?php
> // define directory path
> $dir = "images/user1/";
>
> // iterate through files
> // look for JPEGs
> if (is_dir($dir)) {
> if ($dh = opendir($dir)) {
> while (($file = readdir($dh)) !== false) {
> if (preg_match("/.jpg/", $file)) {
> // read EXIF headers
> $exif = exif_read_data($file, 0, true);
> echo "<tr>";
> // get thumbnail
> // link to full image
> echo "<td valign=top><a
> href=$dir/$file><imgsrc=thumbnail.php?file=$file></a><td>";
> echo "<td valign=top><font size=-1>";
> // get file name
> echo "File: <b>" . $exif['FILE']['FileName'] .
> "</b><br/>";
> // get timestamp
> echo "Timestamp: " . $exif['IFD0']['DateTime'] .
> "<br/>";
> // get image dimensions
> echo "Dimensions: " . $exif['COMPUTED']['Height'] . "
> x " . $exif['COMPUTED']['Height'] . " <br/>";
> // get camera make and model
> echo "Camera: " . $exif['IFD0']['Model'];
> echo "</font></td>";
> echo "</tr>";
> }
> }
> closedir($dh);
> }
> }
> ?>
>
> The question now is how to change the code to dimamically replace the
> folder name by the login username used.
> For example....if user2 logs in the images loaded will be only those
> in the folder images/user2, if user3 logs in it will be from the
> folder images/user3, etc...
> I am a little confused as to how to implement that in Joomla but as
> long as I have the code right I thinkI can just insert the code into
> the appropriate page using a mambot.
> If anybody here has any tips on how to accomplish that it would be
> extremely appreciated.
> Thank you in advance,
>
>
> FayeC
I'm not sure if your question is as easy as it seems, but it seems like
all you need to do is instead of
$dir = "images/user1/";
you go $dir="image/$username";

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация