Calling for an uploaded image VFront/MySQL

Ok, I’ve created a MySQL Database and am using VFront to make it available to others. Everything is working fine so far, you can even upload images with the different entries. However they are only accessible through a link, but i want to output them on a specific page. So instead of clicking on the link first, I want them to show up where the Link is. As I can see this involves Javascript and PHP and I’m a newbie in both ;). I’ve been searching for two days now but can’t figure it out. OK, so here is what I found out on my own.

The Link which leads to the image can be found within a java-script heres the respective snippet:

[code] function handleResponseAL(){ if(httpAL.readyState == 4){
if(httpAL.status == 200){

    var AL = httpAL.responseText;

    // aggiorna i campi
    var arrayAL= AL.split(",");

    // allegati
    if(permettiAllegati==1){
        if(arrayAL[0]>0){

$(‘href_tab_allegati’).innerHTML=’’+(‘attachmentsx’)+’ (’+arrayAL[0]+’)’;
}
else{
$(‘href_tab_allegati’).innerHTML=(‘attachments’)+’ (0)’;
}
}

    // Link
    if(permettiLink==1){
        if(arrayAL[1]>0){
            $('href_tab_link').innerHTML='<strong>'+_('link')+' ('+arrayAL[1]+')</strong>';
        }
        else{
            $('href_tab_link').innerHTML=_('link')+' (0)';
        }
    }

    $('refresh').innerHTML='';
}
else{
alert(_('Error Loading RPC request. Status:')+httpAL.status);
}

}
}[/code]
attachmentsx is the Link

I got the code of the popup-window,where the image shows up, down to what seems to be the essential part for the output of the image:

ini_set('max_execution_time',600);

include("./inc/conn.php");
include("./inc/func.comuni.php");
include("./inc/func.frontend.php");

proteggi(1);

$tabella = preg_replace("'[\W]+'","",trim($_GET['t']));

$id = preg_replace("'[\W]+'","",trim($_GET['id']));

$qa=$vmsql->query("SELECT * FROM "._TABELLA_ALLEGATO."
            WHERE tipoentita='$tabella'
            AND codiceentita='$id'
            ORDER BY nomefileall, lastdata");

$matrice_info_allegati=$vmsql->fetch_assoc_all($qa);


for($i=0;$i<count($matrice_info_allegati);$i++){

                               $estensione=substr($matrice_info_allegati[$i]['nomefileall'],-3,3);

        if($estensione=='gif' || $estensione=='jpg' || $estensione=='png' || 
        $estensione=='GIF' || $estensione=='JPG' || $estensione=='PNG'){

            $immagine='<img src="thumb.php?id='.$matrice_info_allegati[$i]['codiceallegato'].'" alt="'.$matrice_info_allegati[$i]['nomefileall'].'" class="thumb" />';
        }
        else{

            $immagine = img_filetype($matrice_info_allegati[$i]['nomefileall']);
        }

        echo "


            <div class=\"allegato-img\">".$immagine."</div>

 ";
    }

So I know this probably is a really stupid question but which code do I need to insert into the respective site to get a direct output? If you could help me, that would be greatly appreciated!

regards! Mike

Sponsor our Newsletter | Privacy Policy | Terms of Service