Latest News Plus on J4: The image file does not exist.
- Posted by Elisabeth (6) Offline
Can you give me some feedback please on how this is working out?
3 years 1 month ago #7
by Elisabeth
Please Log in or Create an account to join the conversation.
- Posted by Fabrizio Galuppi (4) Offline
Occasionally it happens that a customer makes a mistake with the images of the articles. To prevent the Module from blocking the entire site I made this small change in the Helper.
If there is an error in the Path to the image, then an error JPG is shown, in the same way as the default image.
You have to prepare a JPG called error.jpg and put it in the Assets folder.
From this
To this
I hope it can be helpful
2 years 6 months ago #8
by Fabrizio Galuppi
If there is an error in the Path to the image, then an error JPG is shown, in the same way as the default image.
You have to prepare a JPG called error.jpg and put it in the Assets folder.
From this
// If article contains an image then generate a thumbnail
if($orig_image != ""){
$image = new Image($orig_image);
$resizedImage = $image->cropResize($thumb_width, $thumb_height, true);
$thumb = $resizedImage->toFile(JPATH_BASE.'/'.$thumb_folder.$thumb_alias.'-'.$thumb_name.'.jpg', IMAGETYPE_JPEG, array('quality' => 70));
$thumb_img = '<img src="'.Uri::root().$thumb_folder.$thumb_alias.'-'.$thumb_name.'.jpg" alt="'.$title.'" width="'.$thumb_width.'" height="'.$thumb_height.'"/>';
} else {...
To this
// If article contains an image then generate a thumbnail
if($orig_image != ""){
// Load error.jpg if there si a problem on image path
if(File::exists($orig_image)){
$image = new Image($orig_image);
$resizedImage = $image->cropResize($thumb_width, $thumb_height, true);
$thumb = $resizedImage->toFile(JPATH_BASE.'/'.$thumb_folder.$thumb_alias.'-'.$thumb_name.'.jpg', IMAGETYPE_JPEG, array('quality' => 70));
$thumb_img = '<img src="'.Uri::root().$thumb_folder.$thumb_alias.'-'.$thumb_name.'.jpg" alt="'.$title.'" width="'.$thumb_width.'" height="'.$thumb_height.'"/>';
}else{
$thumb_img = '<img src="'.Uri::root().'modules/'.$modulebase.'/tmpl/assets/error.jpg" alt="'.$title.'" width="'.$thumb_width.'" height="'.$thumb_height.'" />';
}
} else {...
I hope it can be helpful
Please Log in or Create an account to join the conversation.
- Posted by Fabrizio Galuppi (4) Offline
Occasionally it happens that a customer makes a mistake with the images of the articles. To prevent the Module from blocking the entire site I made this small change in the Helper.
If there is an error in the Path to the image, then an error JPG is shown, in the same way as the default image.
You have to prepare a JPG called error.jpg and put it in the Assets folder.
From this
// If article contains an image then generate a thumbnail
if($orig_image != ""){
$image = new Image($orig_image);
$resizedImage = $image->cropResize($thumb_width, $thumb_height, true);
$thumb = $resizedImage->toFile(JPATH_BASE.'/'.$thumb_folder.$thumb_alias.'-'.$thumb_name.'.jpg', IMAGETYPE_JPEG, array('quality' => 70));
$thumb_img = '<img src="'.Uri::root().$thumb_folder.$thumb_alias.'-'.$thumb_name.'.jpg" alt="'.$title.'" width="'.$thumb_width.'" height="'.$thumb_height.'"/>';
} else {...
To this
// If article contains an image then generate a thumbnail
if($orig_image != ""){
// Load error.jpg if there si a problem on image path
if(File::exists($orig_image)){
$image = new Image($orig_image);
$resizedImage = $image->cropResize($thumb_width, $thumb_height, true);
$thumb = $resizedImage->toFile(JPATH_BASE.'/'.$thumb_folder.$thumb_alias.'-'.$thumb_name.'.jpg', IMAGETYPE_JPEG, array('quality' => 70));
$thumb_img = '<img src="'.Uri::root().$thumb_folder.$thumb_alias.'-'.$thumb_name.'.jpg" alt="'.$title.'" width="'.$thumb_width.'" height="'.$thumb_height.'"/>';
}else{
$thumb_img = '<img src="'.Uri::root().'modules/'.$modulebase.'/tmpl/assets/error.jpg" alt="'.$title.'" width="'.$thumb_width.'" height="'.$thumb_height.'" />';
}
} else {...
I hope it can be helpful
2 years 6 months ago #9
by Fabrizio Galuppi
If there is an error in the Path to the image, then an error JPG is shown, in the same way as the default image.
You have to prepare a JPG called error.jpg and put it in the Assets folder.
From this
// If article contains an image then generate a thumbnail
if($orig_image != ""){
$image = new Image($orig_image);
$resizedImage = $image->cropResize($thumb_width, $thumb_height, true);
$thumb = $resizedImage->toFile(JPATH_BASE.'/'.$thumb_folder.$thumb_alias.'-'.$thumb_name.'.jpg', IMAGETYPE_JPEG, array('quality' => 70));
$thumb_img = '<img src="'.Uri::root().$thumb_folder.$thumb_alias.'-'.$thumb_name.'.jpg" alt="'.$title.'" width="'.$thumb_width.'" height="'.$thumb_height.'"/>';
} else {...
To this
// If article contains an image then generate a thumbnail
if($orig_image != ""){
// Load error.jpg if there si a problem on image path
if(File::exists($orig_image)){
$image = new Image($orig_image);
$resizedImage = $image->cropResize($thumb_width, $thumb_height, true);
$thumb = $resizedImage->toFile(JPATH_BASE.'/'.$thumb_folder.$thumb_alias.'-'.$thumb_name.'.jpg', IMAGETYPE_JPEG, array('quality' => 70));
$thumb_img = '<img src="'.Uri::root().$thumb_folder.$thumb_alias.'-'.$thumb_name.'.jpg" alt="'.$title.'" width="'.$thumb_width.'" height="'.$thumb_height.'"/>';
}else{
$thumb_img = '<img src="'.Uri::root().'modules/'.$modulebase.'/tmpl/assets/error.jpg" alt="'.$title.'" width="'.$thumb_width.'" height="'.$thumb_height.'" />';
}
} else {...
I hope it can be helpful
Please Log in or Create an account to join the conversation.
- Posted by TemplatePlazza (5261) Offline