Board Logo

Please Help me
garwil - 6/26/2007 at 07:45 AM

I have inherited an application that allows my users to upload images to a folder and mysql. As a newbie and trying to learn this I have spent five days trying to figure the code out but alas have fallen short
The issue is this...
All users uploads their images to a single folder. The images are renamed as 20.jpg, 21.jpg etc and are auto-incremented so when a user changes an image the name also changes. The database on the other hand only lists an id and venueid which has the same name as the image in the images folder but without the file extension. For me it is difficult to match the db and images together as the php files created to manage this are complicated.
In the page that actually displays the images all I have is a reference to one of the other pages as such -- makegallery( $files, 5, 0, 80, 50); .
So, to cap it all off I have these files created.
1. uploadimage.php
2. makepicfit.php
3. makegallery.php
4. showvenue.php

I won't post all the script here as it is too long but if there is someone out there able to help me integrate this into tigra_hints I would be very grateful.I will then either post or send the files in question..
I have tried to extract the actual files names from an array and tried the solution in thread 4102 but can't get it to work for me.
any takers?

Best regards,

tigra - 6/27/2007 at 05:39 AM

Tigra Hints is the client side script - it works in the browser and it has no way of directly accessing the database and directories on the server. You can add Tigra Hints to your application, but it will not replace your existing php scripts. Please submit a support ticket attaching your files if you want a quote for fixing your php code.

garwil - 6/27/2007 at 08:29 AM

Thanks admin for the reply.
I was just hoping that someone could just show me a way to pull the actual file names from the array created in my own pages to be inserted into tigra hints .e.g

<img src="$pic1/>" width="100" onMouseOver="'tt1', this)" onMouseOut="myHint2.hide()" /> &nbsp;
<img src="$pic2/>" width="100" onMouseOver="'tt1', this)" onMouseOut="myHint2.hide()" /> &nbsp;

If this is not ppossible then I will certainly post a support script if all else fails



tigra - 6/27/2007 at 04:04 PM

if you want to print the value of PHP variable into the HTML stream you can do:
<img src="<? echo $pic1 ?>/>" width="100" ...
<img src="<?= $pic1 ?>/>" width="100" ...
if this is what you're trying to do

garwil - 6/28/2007 at 11:29 AM

I really appreciate you replying on this.

What you are sayins is exactly what I am trying to achieve without getting a whole new image management script. My problem is that I cannot (because I don't know how to do it) create the variable ($pic1.$pic2 etc) out of the array that is being created by the script itself as per below. If I can find out exactly what picture names the array is finding I can then say that (in laymans terms anyway) 'the script is pulling each picture out of the 'venuepics' folder WHERE the image name (without the extension of .jpg) is equal to the id (related to' venueid') in the venuepics table (hope this make sense). Then I can assign whatever name/s the array extracts for that venue into variables called $pic1, $pic2 etc and put those variables into tigra_hints as you indicated.

This code below is located within my showvenue.php page but the actual location in the page where the pictures are visible contains only the line (which is a function) makegallery( $files, 5, 0, 80, 50); between php tags. The makegallery.php contains the following script


function makegallery($files, $cols, $mode, $w, $h)
echo "
<table width="100%" border="0" cellpadding="3" cellspacing="0">";
$count = 0;

foreach( $files as $file ) {

if( $count % $cols == 0 ) echo "</tr>n<tr>n";
if( $mode == 0 ) {
if( substr($file,strlen($file)-3,3) == "gif" || substr($file,strlen($file)-3,3) == "jpg" || substr($file,strlen($file)-3,3) == "png" || substr($file,strlen($file)-4,4) == "jpeg") echo "<td align="center" valign="middle"><a href="/venuepics/".$file."" target="_blank"><img src="/makepicfit.php?file=".$file."&w=".$w."&h=".$h."" style="border: 1px solid #BBBBBB"></a></td>n";
else {
if( substr($file,strlen($file)-3,3) == "gif" || substr($file,strlen($file)-3,3) == "jpg" || substr($file,strlen($file)-3,3) == "png" || substr($file,strlen($file)-4,4) == "jpeg") echo "<td align="center" valign="middle"><img src="/makepicfit.php?file=".$file."&w=".$w."&h=".$h."" style="border: 1px solid #BBBBBB; cursor:pointer;" onClick="if( == '#bbbbbb 1px solid' ) { = '2px solid #FF0000';} else { = '#bbbbbb 1px solid';} "></td>n";


echo "</table>";


This is the code that is in the showvenue.php page..

$pics = dbGetRows("venuepics", "venueid='".$id."'");
$n = 0;
$files = array();
while($pic = mysql_fetch_array($pics, MYSQL_ASSOC))
array_push($files, $pic['id'].".jpg");

I am comptletely lost with this although I did attempt the solution in thread 4102 which seems to be what I am trying to achieve.

Best regards,


tigra - 6/28/2007 at 03:36 PM

According to your code the name of the picture is temporarily stored in variable $file. The value is printed and the loop goes to the next picture. The code doesn't save the names in the array. Pictures directory is "/venuepics/"

garwil - 6/28/2007 at 03:41 PM

/venupics/ is correct as the folder that the images are in.

That teh images is in a single file and looped....does this mean a problem to use with tigra? Or is there another way I can do it?

Back to forum: