`*[foxpro]
Lparameters sss_pict_rules,sss_id_pict,sss_id_html,sss_align,sss_gener_ssil
Local ssss_align

If Pcount()=4

	If sss_align=.T.
		ssss_align='CENTER'
	Else
		ssss_align='LEFT'
	Endif
Else
	ssss_align='LEFT'
Endif
	Local nn_select_n
	nn_select_n=Select()
	Local ppkk,zz_sst,zzt_dop
	ppkk=nacal_dire+"\maple4_ru_projects\"+Alltrim(vp_tek_folder)+"\a_ppn_table_picture"
	Select * From (ppkk) Where id_=sss_id_pict Into Cursor zz_pictures
	If Reccount()=0
		Use
		Return ""
	Endif


	ppkk=nacal_dire+"\a_rules_picture"
	Select * From (ppkk) Where Alltrim(name_)=sss_pict_rules Into Cursor zz_rules
	If Reccount()=0
		Use
		Return ""
	Endif

	zzt_dop=""
	zz_sst=""


*wait window "3   "+str(zz_pictures.width_)+str(zz_pictures.height_)+"  "+Alltr(zz_pictures.pict1namef)

	If Not(Empty(Alltr(zz_pictures.pict1namef)))
		zzt_dop=""
		If zz_rules.t1_vmax=.T.

			do case 
			case zz_rules.t1_vmaxwh=1 or zz_rules.t1_vmaxwh=0
				If zz_pictures.width_>zz_rules.t1_vmaxsz
					zzt_dop="width="+Alltr(Str(zz_rules.t1_vmaxsz))
				Else
					zzt_dop="height="+Alltr(Str(zz_pictures.height_))+"  "+"width="+Alltr(Str(zz_pictures.width_))
				Endif
			case zz_rules.t1_vmaxwh=2
				If zz_pictures.height_>zz_rules.t1_vmaxsz
					zzt_dop="height="+Alltr(Str(zz_rules.t1_vmaxsz))
				Else
					zzt_dop="height="+Alltr(Str(zz_pictures.height_))+"  "+"width="+Alltr(Str(zz_pictures.width_))
				Endif
			case zz_rules.t1_vmaxwh=3


				if zz_pictures.width_>zz_pictures.height_

					If zz_pictures.width_>zz_rules.t1_vmaxsz
					zzt_dop="width="+Alltr(Str(zz_rules.t1_vmaxsz))
					Else
					zzt_dop="height="+Alltr(Str(zz_pictures.height_))+"  "+"width="+Alltr(Str(zz_pictures.width_))
					Endif

				else 

					If zz_pictures.height_>zz_rules.t1_vmaxsz
					zzt_dop="height="+Alltr(Str(zz_rules.t1_vmaxsz))
					Else
					zzt_dop="height="+Alltr(Str(zz_pictures.height_))+"  "+"width="+Alltr(Str(zz_pictures.width_))
					Endif
	


				endif 
			endcase 
		Else
			zzt_dop="height="+Alltr(Str(zz_pictures.height_))+"  "+"width="+Alltr(Str(zz_pictures.width_))
		Endif


		If sss_gener_ssil=.f.

			dd_sst_href='<A HREF="'+"i_news_page_"+padl(sss_id_html,15,"0")+'.html" target=_blank'+'>'
			dd_sst_href_='</A>'
		Else
			dd_sst_href='<A HREF="'+Alltr(zz_pictures.pict1namef)+'" target=_blank'+'>'
			dd_sst_href_='</A>'

		Endif



 	If zz_rules.in_resize=1 And zz_rules.t1_vmax=.T.

		Local resize_pic
		resize_pic=""
		Local ww,hh
		If zz_pictures.width_>0 And zz_pictures.width_<999999 And zz_pictures.height_>0 And zz_pictures.height_<999999
			Do Case
			Case  zz_rules.t1_vmaxwh=1 Or zz_rules.t1_vmaxwh=0
				ww=Padl(zz_rules.t1_vmaxsz,6,"0")
				hh="000000"
				resize_pic="_resizepicturemaple4"+"_"+ww+"_"+hh
			Case  zz_rules.t1_vmaxwh=2
				ww="000000"
				hh=Padl(zz_rules.t1_vmaxsz,6,"0")
				resize_pic="_resizepicturemaple4"+"_"+ww+"_"+hh

			Case  zz_rules.t1_vmaxwh=3
				ww=Padl(zz_rules.t1_vmaxsz,6,"0")
				hh=Padl(zz_rules.t1_vmaxsz,6,"0")
				resize_pic="_resizepicturemaple4"+"_"+ww+"_"+hh
			Endcase

		Endif
		zz_sst=zz_sst+dd_sst_href+'<IMG '+zzt_dop+'  src="'+;
			JUSTSTEM(Alltr(zz_pictures.pict1namef))+resize_pic+"."+Justext(zz_pictures.pict1namef)+;
			'" align='+ssss_align+' border=0>'+dd_sst_href_+'<BR>'

else 
		zz_sst=zz_sst+dd_sst_href+'<IMG '+zzt_dop+'  src="'+Alltr(zz_pictures.pict1namef)+'" align='+ssss_align+' alt="'+alltr(zz_pictures.short_)+'"'+' border=0>'+dd_sst_href_+'<BR>'
endif 

	Endif

	If nn_select_n<>0
		Select (nn_select_n)
	Endif

	Return zz_sst
`