当我为图像充电时,该图像看起来是翻转的,但是只有一些图像,并且所有图像都是通过dropzone上传的,我有一个仅通过拖动来上传图像的表格,因为该图像只允许上传一张用于每个生日男孩的个人资料图片,然后上传照片并将程序定向到驱动程序,驱动程序将验证字段,然后使用不存在用户ID的文件夹创建一个文件夹(如果该文件夹不存在),最后使用用户的ID作为名称,从而替换了前一张照片,但是对于某些照片,该照片被翻转了,但原因并非如此,并且在数据库中存储了照片的名称及其扩展名。
显示照片的表单由另一个驱动程序加载,该驱动程序会加载照片和用户信息,然后通过jquery将获取的信息填充到视图中。
这时,您已经插入了图像并将名称存储在数据库中,但是在加载图像时,您会看到它旋转了90度
<!--View-->
<?php
$link = mysqli_connect("localhost", "pruebas", "xxxx");
mysqli_select_db($link, "colitali_iqpantallas");
$tildes = $link->query("SET NAMES 'utf8'"); //Para que se muestren las tildes correctamente
$result = mysqli_query($link, "SELECT * FROM birthdays ORDER BY id");
$estado ="active";
$contador=0;
$delete="";
?>
<div class="alert alert-dismissible" role="alert" style="display: none;">
</div>
<table id="tableBirthdays" class="table display">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Nombre</th>
<th scope="col">Apellido</th>
<th scope="col">Cargo</th>
<th scope="col">Fecha de Nacimiento</th>
<th scope="col">Inicio del cargo</th>
<th scope="col">Imagen</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Id</th>
<th>Nombre</th>
<th>Apellido</th>
<th>Cargo</th>
<th>Fecha de Nacimiento</th>
<th>Inicio del cargo</th>
<th>Imagen</th>
</tr>
</tfoot>
<tbody class="contentTable">
<?php
while ($fila = mysqli_fetch_array($result)){
$estado="";
$col_name=$fila['name'];
$col_surname=$fila['surname'];
$col_job=$fila['job'];
$col_id=$fila['id'];
$col_start=$fila['start'];
$col_cumple=$fila['day']."/".$fila['month']."/".$fila['year'];
$col_image=($fila['image']==NULL) ? "default.png" : $col_id."/".$fila['image'] ;
$delete .= '<option class="opcionBirthdays" data-src="birthday" value="'.$col_id.'" title="'.$col_name." ".$col_surname.'">';
$delete .= $col_id.". ";
$delete .= $col_name." ".$col_surname;
$delete .= '</option>';
?>
<tr>
<td>
<label><?php echo $col_id; ?></label>
</td>
<td>
<div class="col">
<div class="row">
<input class="form-control" type="text" name="name" value="<?php echo $col_name; ?>" width="150" id="birthdaysName-<?php echo $col_id; ?>" required/>
<label class="d-none"><?php echo $col_name; ?></label>
</div>
<div class="row">
<button type="button" value="Guardar" name="detail" class="botonIQ btnGuardar" data-action='controller/uploadBirthday.php?tipo=1&code=<?php echo $col_id; ?>'>Guardar</button>
</div>
</div>
</td>
<td>
<div class="col">
<div class="row">
<input class="form-control" type="text" name="surname" value="<?php echo $col_surname; ?>" width="150" id="birthdaysSurname-<?php echo $col_id; ?>" required/>
<label class="d-none"><?php echo $col_surname; ?></label>
</div>
<div class="row">
<button type="button" value="Guardar" name="detail" class="botonIQ btn-xs btnGuardar" data-action='controller/uploadBirthday.php?tipo=2&code=<?php echo $col_id; ?>'>Guardar</button>
</div>
</div>
</td>
<td>
<div class="col">
<div class="row">
<input class="form-control" type="text" name="job" value="<?php echo $col_job; ?>" width="150" id="birthdaysJob-<?php echo $col_id; ?>"required/>
<label class="d-none"><?php echo $col_job; ?></label>
</div>
<div class="row">
<button type="button" value="Guardar" name="detail" class="botonIQ btnGuardar" data-action='controller/uploadBirthday.php?tipo=3&code=<?php echo $col_id; ?>'>Guardar</button>
</div>
</div>
</td>
<td>
<div class="col">
<div class="row">
<input id="birthdaysBirthday-<?php echo $col_id; ?>" class="datepicker form-control" data-elemento="birthdays" width="150" value="<?php echo $col_cumple; ?>" name="birthday" readonly required/>
<label class="d-none"><?php echo $col_cumple; ?></label>
</div>
<div class="row">
<button type="button" value="Guardar" name="detail" class="botonIQ btn-xs btnGuardar" data-action='controller/uploadBirthday.php?tipo=4&code=<?php echo $col_id; ?>'>Guardar</button>
</div>
</div>
</td>
<td>
<div class="col">
<div class="row">
<input id="birthdaysStart-<?php echo $col_id; ?>" class="datepicker form-control" data-elemento="birthdays" width="150" value="<?php echo $col_start; ?>" name="start" readonly required/>
<label class="d-none"><?php echo $col_start; ?></label>
</div>
<div class="row">
<button type="button" value="Guardar" name="detail" class="botonIQ btnGuardar" data-action='controller/uploadBirthday.php?tipo=5&code=<?php echo $col_id; ?>'>Guardar</button>
</div>
</div>
</td>
<td>
<form action='controller/uploadBirthday.php?tipo=6&code=<?php echo $col_id; ?>' class='dropzone' data-elemento="birthdays" enctype='multipart/form-data' id='birthdaysImage-<?php echo $col_id; ?>' style="height: 150px; width: 100px; font-size: 10px">
<img class='img-l miniImagen' width="40px" height="40px" src='images/<?php echo $col_image; ?>' />
</form>
</td>
</tr>
<?php
$contador++;
}
?>
<!-- Controller -->
<?php
include_once "con.php";
switch ($_GET['tipo']) {
case 1:
//Modificar el nombre //error
break;
case 2:
//Modificar el apellido
break;
case 3:
//Modificar el cargo
break;
case 4:
//Modificar la fecha de nacimiento
break;
case 5:
//Modificar la fecha en la que empezo a trabjar
break;
case 6:
//Modificar la imagen
if (isset($_GET['code'])) {
$id=$_GET['code'];
if (!file_exists('../images/'.$id)) {
$oldmask = umask(0);
mkdir('../images/'.$id, 0777);
umask($oldmask);
}
if($fila['image']!=NULL) {
unlink('../images/'.$id."/".$id.'.png');
}
$ds = DIRECTORY_SEPARATOR;
$storeFolder = '../images/'.$id;
if (!empty($_FILES)) {
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds;
$targetFile = $targetPath.$id. ".png";
move_uploaded_file($tempFile,$targetFile);
$con->query("SET NAMES 'utf8'");
$sentencia = $con->prepare("UPDATE birthdays SET image = ? WHERE id = ?;");
$resultado = $sentencia->execute([$id.'.png', $id]);
}
else {
die("No se a subido nada");
}
}
else {
die("No se a recibido nada");
}
break;
}
include_once "bitacora.php";
header('Location: ../home.php?forms=birthdays');
?> ```
The image should look right, that is to say as it was taken with the cell phone or the camera, but it is seen flipped
[!look the this image, this is the visual of the problem][1]][1]
[1]: https://i.stack.imgur.com/zMg6A.png