Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

bertu

com Componentes

Recommended Posts

Navegando pelo forum encontrei esse post aki http://forum.imasters.com.br/index.php?showtopic=219420 que lista os componentes instalados no servidor! Queria uma ajuda de voces!!

 

Queria saber se tem como eu fazer uma implementacao nesse codigo, sou programador java e ASP nao e muito minha praia.

 

Gostaria de saber se tem como eu fazer algo do tipo, se tiver o Componente WScript.Shell ele executa tais comandos com o WSript.Shell, se tiver o ASPExec ele executar comandos para o ASPExec... e se tiver o DynuExec .... Assim por diante, estou fazendo um scriptzim que roda em varios computador diferentes, e pode ser q cada um tenha um componente diferente... dae queria saber se tem como! vlw obrigado []'s

 

ahhh e se caso nao tiver o componente nao executar o comando, pois pode gerar um erro de permissao ou algo parecido vlww galeraaa

Compartilhar este post


Link para o post
Compartilhar em outros sites

Segue abaixo parte de um código do gaúcho. Esse código está relacionado a classe de Imagem do script CROPPER, postado no sub-fórum Laboratório de Scripts (ASP).

 

Nele tem isso que você quer, mas utilizando componentes de imagem.

select case uCase(component)
		
			case "ASPIMAGE"
			
				Set objImage = Server.CreateObject("AspImage.Image")
				'redimensiona e renomeia a imagem original		
				objImage.LoadImage(tempPath & originalNameFile)
				objImage.PixelFormat = 6
				objImage.ImageFormat = formatImage
				objImage.JPEGQuality = quality
				width 	= int(objImage.MaxX)
				height 	= int(objImage.MaxY)
				
				'cria o thumb	a partir da imagem original
				if width>maxW or height>maxH then
					newWidth = maxW
					newHeight = (maxW * height) \ width
					'[ Se a altura ficar menor que o esperado, aumenta a largura
					if newHeight>maxH then
						newHeight = maxH
						newWidth = (maxH * width) \ height
					end if
					 y = newWidth
					 x = newHeight
				else
					y = width
					x = height
				end if
				'[ Redimensiona e salva a imagem
				objImage.ResizeR y , x
				objImage.Filename = imagePath & newNameFile
				objImage.SaveImage
				
				if verificaArquivo(imagePath & newNameFile) = false then
					set objImage = nothing
					Response.Write("ERRO ao redimensionar imagem")
					Response.End()
				end if					
		
					objImage.LoadImage(imagePath & newNameFile)	
					'cria o thumb	a partir da imagem original
					if y <> thumbMaxW then
						'[ Calcula a altura
						height = (x * thumbMaxW) \ y
						width = thumbMaxW				
						'[ Se a altura ficar menor que o esperado, aumenta a largura
						if height < thumbMaxH then
							width = (y * thumbMaxH) \ x
							height = thumbMaxH
						end if				
						'[ Redimensiona a imagem
						objImage.ResizeR width, height				
						'[ Salva a imagem
						objImage.Filename = thumbPath & thumbName
						objImage.SaveImage
						
						if verificaArquivo(thumbPath & thumbName) = false then
							set objImage = nothing
							Response.Write("ERRO ao criar o thumb Padrão")
							Response.End()
						end if							
						
					end if
					

				Set objImage = Nothing
		
			case "ASPJPEG"

				Set objImage = Server.CreateObject("Persits.Jpeg")
				
				objImage.PreserveAspectRatio = True
				objImage.Quality  = quality

				'redimensiona e renomeia a imagem original
				objImage.open tempPath & originalNameFile
				objImage.Interpolation = 1	
				objImage.Sharpen 1,101
				objImage.PreserveAspectRatio = True
				
				width 	= int(objImage.OriginalWidth)
				height 	= int(objImage.OriginalHeight)
				
				'cria o thumb	a partir da imagem original
				if width>maxW or height>maxH then
					newWidth 	= maxW
					newHeight = (maxW * height) \ width
					'[ Calcula a altura
					if newHeight>maxH then
						'[ Se a altura ficar menor que o esperado, aumenta a largura
						newHeight = maxH
						newWidth 	= (maxH * width) \ height
					end if
					 y = newWidth
					 x = newHeight
				else
					y = width
					x = height
				end if
				'redimensiona e salva a imagem
				objImage.Width = y
				objImage.Height = x
				objImage.save imagePath & newNameFile
				if verificaArquivo(imagePath & newNameFile) = false then
					set objImage = nothing
					Response.Write("ERRO ao redimensionar imagem")
					Response.End()
				end if					
		
					objImage.open imagePath & newNameFile
					'cria o thumb	a partir da imagem original
					if y <> thumbMaxW then
						'[ Calcula a altura
						height = (x * thumbMaxW) \ y
						width = thumbMaxW				
						'[ Se a altura ficar menor que o esperado, aumenta a largura
						if height < thumbMaxH then
							width = (y * thumbMaxH) \ x
							height = thumbMaxH
						end if
						'redimensiona e salva a imagem			
						objImage.Width 	= width
						objImage.Height = height
						objImage.save thumbPath & thumbName						

						if verificaArquivo(thumbPath & thumbName) = false then
							set objImage = nothing
							Response.Write("ERRO ao criar o thumb Padrão")
							Response.End()
						end if								
						
					end if
					

				set objImage = nothing
				
			case else
			
				Response.Write("Objeto inválido. Somente ASPJPEG ou ASPIMAGE")
				Response.End()
				
		end select

Compartilhar este post


Link para o post
Compartilhar em outros sites

hmmm legal!! vlw acho que era isso que eu precisava... é tipo o switch do java e do php! nao sabia que tinha case pro ASP

vou tentar aqui e mais pra frente posto aqui se consegui! vlwww

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.