var
  VUrl1: String;
  VUrl2: String;
  VCache1: String;
  VCache2: String;
  VLocal1: String;
  VLocal2: String;
  VExt: String;
  VEnabled: Boolean;
  VCaption: String;
  VUserNumber: String;
  VUserDescr: String;
begin
  VEnabled := MapAttachmentsInfo.GetEnabled(0);
  
  if (not VEnabled) then
  begin
    ResultText := SourceText;
    Exit;
  end;
  
  // get params
  VUrl1 := MapAttachmentsInfo.GetDefURLBase(1);
  VUrl2 := MapAttachmentsInfo.GetDefURLBase(2);
  VCache1 := MapAttachmentsInfo.GetNameInCache(1);
  VCache2 := MapAttachmentsInfo.GetNameInCache(2);
  VExt := MapAttachmentsInfo.GetExt(0);
  
  // make local path for medium image
  VLocal1 := VCache1+AttachmentSubCache+AttachmentNumber+VExt;
  // download medium image
  //if (not FileExists(VLocal1)) then // if file not exists
    //DownloadFileToLocal(VUrl1+AttachmentNumber+VExt, VLocal1, MapAttachmentsInfo.GetContentType(1));
  
  // make local path for original image
  VLocal2 := VCache2+AttachmentSubCache+AttachmentNumber+VExt;
  // download original image
  //if (not FileExists(VLocal2)) then // if file not exists
    //DownloadFileToLocal(VUrl2+AttachmentNumber+VExt, VLocal2, MapAttachmentsInfo.GetContentType(2));
  
  // obtain description with tags
  VCaption := GetBetween(SourceText,'<h1>','</h1>');
  
  // replace filenames to http format
  VLocal1 := 'file:///' + RegExprReplaceMatchSubStr(VLocal1,'\\','\/');
  VLocal2 := 'file:///' + RegExprReplaceMatchSubStr(VLocal2,'\\','\/');
  
  // get user info
  VUserNumber := GetBetween(SourceText,'panoramio.com/user/','</a>');
  VUserDescr := GetAfter('>',VUserNumber);
  VUserNumber := GetNumberAfter('panoramio.com/user/',SourceText);
  
  // make result html text
  ResultText := '<a href="'+VLocal2+'"><img src="'+VLocal1+'" alt="  "></a><br>'+
                '<h1>'+VCaption+'</h1>'+
                ' : <a href="http://www.panoramio.com/user/'+VUserNumber+'">'+VUserDescr+'</a><br>'+
                '<a href="http://www.panoramio.com/photo/'+AttachmentNumber+'">   Panoramio</a>';



end.