Consider I have an image named "car.jpg".
I have multi-language stores in my site and client wants to show the same image in various languages. Like car is called voiture in French so the image name should be "voiture.jpg", but it will show the same image i.e. car.jpg.
Also while saving / downloading the image it should get saved as voiture.jpg from the French store and car.jpg from the English store.
I have plans to input the names of the images from the client via a back-end panel, but can’t get ideas about how to implement this in front-end.
Note:- The image is not on my server
I have copied the image on fly and can use it as below, using class upload, but need a better option than coping image as there are above 4000 images.
<img src='./media/scene7/car.jpg' alt='car'>
<?php
include('class.upload.php');
$img = new Upload('media/scene7/car.jpg');
if ($img->uploaded) {
$img->file_new_name_body = 'voiture';
$img->file_auto_rename = false;
$img->file_overwrite = true;
$img->Process('./media/scene7/translated/');
}else{
}
echo "<br /><br />Car is called voiture in French, you are seeing the image of voiture.<br />";
?>
<img src='./media/scene7/translated/voiture.jpg' alt='car'>
<?php
if ($img->uploaded) {
$img->file_new_name_body = 'auto';
$img->file_auto_rename = false;
$img->file_overwrite = true;
$img->Process('./media/scene7/translated/');
}else{
echo "not uploaded";
}
echo "<br /><br />Car is called auto in German, you are seeing the image of auto.<br />";
?>
<img src='./media/scene7/translated/auto.jpg' alt='car'>
<?php
if ($img->uploaded) {
$img->file_new_name_body = 'coche';
$img->file_auto_rename = false;
$img->file_overwrite = true;
$img->Process('./media/scene7/translated/');
}else{
echo "not uploaded";
}
echo "<br /><br />Car is called coche in Spanish, you are seeing the image of coche.<br />";
?>
<img src='./media/scene7/translated/coche.jpg' alt='car'>
<?php
$img = new Upload('http://s7d7.scene7.com/is/image/zeon/Stack_Mouse');
if ($img->uploaded) {
echo 'uploaded image from url';
}else{
echo $img->error;
}
?>