Connecting Tech Pros Worldwide Forums | Help | Site Map

how to create a gallery without using the EXIF function?

FayeC
Guest
 
Posts: n/a
#1: Nov 22 '05
I have tried to use a php code (found it online) to create a gallery
but I am wondering if thereare any other PHP options besides using
EXIF.
The reason is that the images I am using for the gallery are not taken
using a camera and therefore don't have the EXIF data.
And since the images will be uploaded by a third party who is not very
computer savvy the option of having them edit the images to add the
EXIF data is not a very feasible one so I am looking for other options
in PHP.
Please bear with me.....I am a novice PHP programmer (more like a
newbie) and although I do understand the basics of programming and do
some programming in ASP, PHP looks very foreign to me right now....
I am trying my best to learn from books but so far I haven't learned
enough to implement this on my own so I am asking for some help from
the experts.
I need to create a code that will pull out 4 images from a folder that
will have the same username as the user's login.
After login the user is taken to a page that will contain the 4 images
in the folder arranged in a table or div.
The issue right now is finding something that can work side by side
with Joomla.....unless I use a page not in Joomla at all....which
would make the programming much easier maybe?
WHat do you think?
Thank you in advance for any help finding an answer.

FayeC

Geoff Berrow
Guest
 
Posts: n/a
#2: Nov 22 '05

re: how to create a gallery without using the EXIF function?


Message-ID: <i015o1d4ev501ijadrb4s5ptdg3d233j9m@4ax.com> from FayeC
contained the following:
[color=blue]
>I need to create a code that will pull out 4 images from a folder that
>will have the same username as the user's login.
>After login the user is taken to a page that will contain the 4 images
>in the folder arranged in a table or div.[/color]


I started work on something similar last night.
http://www.ckdog.co.uk/jladder/files.php
It crudely shows .jpgs in a directory as thumbnails (simple browser
resizing). I've still got quite a bit to do, but it may be useful.


<HTML>
<HEAD>
<TITLE>File management</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">


<table align="center" border="1" cellspacing="0" cellpadding="2">
<?php

//$dir = $path."";
$path=$_SERVER['PATH_TRANSLATED'];
//print "$path<br>";
$i= strlen($path);
//print"$i<br>";
do{$i--;}
while(strpos($path,"/",$i)===false);
//print"$i<br>";
//print substr($path,0,$i);
$path=substr($path,0,$i+1);
$dir=$path;

// Open a known directory, and proceed to read its contents
//if (is_dir($dir)) {
$width=100;
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
//print $dir . $file;
if($file!="." && $file!=".." &&
strtolower(substr($file,-3))=="jpg"){

$size = getimagesize($file);

$height=($size[1]*$width)/$size[0];
echo "<tr><td><img src='$file'width='$width'
height='$height'></td><td><b> <a
href=\"$file\">$file</a></b></td></tr>\n";
}
}
closedir($dh);
}
//}
?>


</table>
</form>
</BODY>
</HTML>

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
cyberhorse
Guest
 
Posts: n/a
#3: Nov 22 '05

re: how to create a gallery without using the EXIF function?


Why do you think you have to use exif in the first place?

Here is more sample code to get you started:
http://prdownloads.sourceforge.net/s...r.bz2?download

FayeC wrote:[color=blue]
> I have tried to use a php code (found it online) to create a gallery
> but I am wondering if thereare any other PHP options besides using
> EXIF.
> The reason is that the images I am using for the gallery are not taken
> using a camera and therefore don't have the EXIF data.
> And since the images will be uploaded by a third party who is not very
> computer savvy the option of having them edit the images to add the
> EXIF data is not a very feasible one so I am looking for other options
> in PHP.
> Please bear with me.....I am a novice PHP programmer (more like a
> newbie) and although I do understand the basics of programming and do
> some programming in ASP, PHP looks very foreign to me right now....
> I am trying my best to learn from books but so far I haven't learned
> enough to implement this on my own so I am asking for some help from
> the experts.
> I need to create a code that will pull out 4 images from a folder that
> will have the same username as the user's login.
> After login the user is taken to a page that will contain the 4 images
> in the folder arranged in a table or div.
> The issue right now is finding something that can work side by side
> with Joomla.....unless I use a page not in Joomla at all....which
> would make the programming much easier maybe?
> WHat do you think?
> Thank you in advance for any help finding an answer.
>
> FayeC[/color]

FayeC
Guest
 
Posts: n/a
#4: Nov 25 '05

re: how to create a gallery without using the EXIF function?


I tried it and just modified the path as it is adding the username to
the path but I then get several errors
regarding not opening the stream and also a division by 0:
<?php
$username = $_POST['username'];
//$dir = $path."";
$path = "images/" . $username;
//print "$path<br>";
$i= strlen($path);
//print"$i<br>";
do{$i--;}
while(strpos($path,"/",$i)===false);
//print"$i<br>";
//print substr($path,0,$i);
$path=substr($path,0,$i+1);
$dir=$path;

// Open a known directory, and proceed to read its contents
//if (is_dir($dir)) {
$width=100;
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
//print $dir . $file;
if($file!="." && $file!=".." &&
strtolower(substr($file,-3))=="jpg"){

$size = getimagesize($file);

$height=($size[1]*$width)/$size[0];
echo "<tr><td><img src='$file'width='$width'
height='$height'></td><td><b> <a
href=\"$file\">$file</a></b></td></tr>\n";
}
}
closedir($dh);
}
//}
?>

Gets:
Warning: getimagesize(joomla_logo_black.jpg) [function.getimagesize]:
failed to open stream: No such file or directory in
f:\apache_root\ucbaby\on\gallery.php on line 71

Warning: Division by zero in f:\apache_root\ucbaby\on\gallery.php on
line 73

FayeC

On Tue, 22 Nov 2005 07:04:13 +0000, Geoff Berrow
<blthecat@ckdog.co.uk> wrote:
[color=blue]
>Message-ID: <i015o1d4ev501ijadrb4s5ptdg3d233j9m@4ax.com> from FayeC
>contained the following:
>[color=green]
>>I need to create a code that will pull out 4 images from a folder that
>>will have the same username as the user's login.
>>After login the user is taken to a page that will contain the 4 images
>>in the folder arranged in a table or div.[/color]
>
>
>I started work on something similar last night.
>http://www.ckdog.co.uk/jladder/files.php
> It crudely shows .jpgs in a directory as thumbnails (simple browser
>resizing). I've still got quite a bit to do, but it may be useful.
>
>
><HTML>
><HEAD>
><TITLE>File management</TITLE>
><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
></HEAD>
><BODY BGCOLOR="#FFFFFF" TEXT="#000000">
>
>
><table align="center" border="1" cellspacing="0" cellpadding="2">
><?php
>
>//$dir = $path."";
>$path=$_SERVER['PATH_TRANSLATED'];
>//print "$path<br>";
>$i= strlen($path);
>//print"$i<br>";
>do{$i--;}
>while(strpos($path,"/",$i)===false);
>//print"$i<br>";
>//print substr($path,0,$i);
>$path=substr($path,0,$i+1);
>$dir=$path;
>
>// Open a known directory, and proceed to read its contents
>//if (is_dir($dir)) {
>$width=100;
> if ($dh = opendir($dir)) {
> while (($file = readdir($dh)) !== false) {
> //print $dir . $file;
> if($file!="." && $file!=".." &&
>strtolower(substr($file,-3))=="jpg"){
>
> $size = getimagesize($file);
>
> $height=($size[1]*$width)/$size[0];
> echo "<tr><td><img src='$file'width='$width'
>height='$height'></td><td><b> <a
>href=\"$file\">$file</a></b></td></tr>\n";
> }
> }
> closedir($dh);
> }
>//}
>?>
>
>
></table>
></form>
></BODY>
></HTML>[/color]
Geoff Berrow
Guest
 
Posts: n/a
#5: Nov 25 '05

re: how to create a gallery without using the EXIF function?


Message-ID: <1a5fo15abhng32vj8r7lvenrfodjmjqe6q@4ax.com> from FayeC
contained the following:
[color=blue]
>I tried it and just modified the path as it is adding the username to
>the path but I then get several errors
>regarding not opening the stream and also a division by 0:[/color]

Yeah, the path has to be the full path to the directory. But I'm doing
it slightly differently now.

I've replaced:

//$dir = $path."";
$path=$_SERVER['PATH_TRANSLATED'];
//print "$path<br>";
$i= strlen($path);
//print"$i<br>";
do{$i--;}
while(strpos($path,"/",$i)===false);
//print"$i<br>";
//print substr($path,0,$i);
$path=substr($path,0,$i+1);
$dir=$path;

with

$path=$_SERVER['SCRIPT_FILENAME'];
$dir=dirname($path);

This will give you the path to the current directory. You'll have to
append any subdirectory info to that.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Closed Thread