- Postagens: 5
- Obrigados Recebidos: 0
- Fórum
- /
- Suporte Joomla
- /
- Componentes
- /
- Joomla 1.5
- /
- RESOLVIDO: Bloquear upload imagem > q 50kb no frontepage
RESOLVIDO: Bloquear upload imagem > q 50kb no frontepage
- janaina.lima
-
Autor do Tópico
- Offline
- JCB! Novato
-
Menos
Mais
14 anos 1 mês atrás #55025
por janaina.lima
janaina.lima created the topic: RESOLVIDO: Bloquear upload imagem > q 50kb no frontepage
Preciso de ajuda!
Estou alterando o componente frontpage slideshow para que ao adicionar uma imagem que já esteja no servidor ele não permita salvar uma imagem maior que 50 kb.
Para fazer o upload da máquina do usuário o seguinte código resolveu:
Mas não consigo o mesmo para imagens que já estão no servidor do joomla, o que estou fazendo de errado?
Estou alterando o componente frontpage slideshow para que ao adicionar uma imagem que já esteja no servidor ele não permita salvar uma imagem maior que 50 kb.
Para fazer o upload da máquina do usuário o seguinte código resolveu:
if($imageaction==2) { // if action is to upload image
if($_FILES['image']['size']<=51200) { // if is selected an image
if(!$image = mosFPSlideShow::uploadMedia($_FILES, 'image', $option, "", $width, $quality)) { // if the image is uploaded
$msg = _FPSS_UPLOAD_FAIL7;
$mainframe->redirect( 'index.php?option='.$option.'&task=slides&filter_catid='.$row->catid.'&limit='.$limit.'&limitstart='.$limitstart, $msg );
}// $image the new path of the image
}else{
$teste = $_FILES['image']['size'];
$msg = _FPSS_SLIDE_SIZE_IMAGE;
$mainframe->redirect( 'index.php?option='.$option.'&task=slides&filter_catid='.$row->catid.'&limit='.$limit.'&limitstart='.$limitstart, $msg );
Mas não consigo o mesmo para imagens que já estão no servidor do joomla, o que estou fazendo de errado?
} } elseif($imageaction==3) { // if the action is an image on the server
// get the complete abs path
$abspath = str_replace($mosConfig_live_site,$mosConfig_absolute_path,$serverimage);
if($_FILES['image']['size']<=51200){
if(is_file($abspath)) { // if is selected an image
if(!$image = mosFPSlideShow::uploadMediaServer($abspath, 'image', $option, "", $width, $quality)) { // if the image is uploaded
$teste = $_FILES['image']['size'];
$msg = _FPSS_SLIDE_SIZE_IMAGE;;
}else{
$mainframe->redirect( 'index.php?option='.$option.'&task=slides&filter_catid='.$row->catid.'&limit='.$limit.'&limitstart='.$limitstart, $msg );
$msg = _FPSS_UPLOAD_FAIL7;
}
Please Entrar ou Registrar to join the conversation.
- janaina.lima
-
Autor do Tópico
- Offline
- JCB! Novato
-
Menos
Mais
- Postagens: 5
- Obrigados Recebidos: 0
14 anos 1 mês atrás #55069
por janaina.lima
janaina.lima replied the topic: Re: Bloquear upload de imagem maior que 50kb no frontepage slids
Resolvido: <!-- s:ok: --><img src="{SMILIES_PATH}/ok.gif" alt=":ok:" title="Ok" /><!-- s:ok: -->
É uma pena ninguém ter se proposto a ajudar... a troca de conhecimento ajudaria a muitos.
Por isso, coloco a solução encontrada por um amigo.
É uma pena ninguém ter se proposto a ajudar... a troca de conhecimento ajudaria a muitos.
Por isso, coloco a solução encontrada por um amigo.
} elseif($imageaction==3) { // if the action is an image on the server
// get the complete abs path
$abspath = str_replace($mosConfig_live_site,$mosConfig_absolute_path,$serverimage);
if(is_file($abspath)) { // if is selected an image
//Condição de tamanho
[b]if(filesize($abspath) >=51200) { // if the image is uploaded
$msg = _FPSS_SLIDE_SIZE_IMAGE;[/b]
$mainframe->redirect( 'index.php?option='.$option.'&task=slides&filter_catid='.$row->catid.'&limit='.$limit.'&limitstart='.$limitstart, $msg );
// $image the new path of the image
}
if(!$image = mosFPSlideShow::uploadMediaServer($abspath, 'image', $option, "", $width, $quality)) { // if the image is uploaded
$msg = _FPSS_UPLOAD_FAIL3;
$mainframe->redirect( 'index.php?option='.$option.'&task=slides&filter_catid='.$row->catid.'&limit='.$limit.'&limitstart='.$limitstart, $msg );
// $image the new path of the image
}
Please Entrar ou Registrar to join the conversation.