Commit 89bd9fb8 authored by Erma Safira Nurmasyita's avatar Erma Safira Nurmasyita
Browse files

[FIX] Book Detail picture displays

parent 1af83651
......@@ -41,7 +41,7 @@
</div>
<div class="add-flex-direction-column" id="rightbar-pic" align="center">
<div class="flex-1">
<img id="book-pict" src="'.self::showPicture('books','../images/books_picture/default.jpg').'">
<img id="book-pict" src="'.self::showPicture('book', $book_detail['ID']).'">
</div>
<div class="rating-pict">'.
self::drawRating($book_rating).
......@@ -67,11 +67,19 @@
return $str . '</div>';
}
private function showPicture($obj, $picSrc) {
if ($picSrc == NULL) {
return '../images/'. $obj .'_picture/default.jpg';
private function showPicture($obj, $input) {
if ($obj == "book") {
if (fileProcessing::isExistBookImage($input)) {
return fileProcessing::getImageBookPathFromRoot($input);
} else {
return '/images/books_picture/default.jpg';
}
} else {
return $picSrc;
if (fileProcessing::isExistProfileImage($input)) {
return fileProcessing::getImageProfilePathFromRoot($input);
} else {
return '/images/profiles_picture/default.jpg';
}
}
}
......@@ -110,7 +118,7 @@
<div class="flex-container align-items-flex-start">
<div class="flex-1 flex-review-tab">
<div class="reviewer-profile">
<img id="profile_pict" src="'.self::showPicture('profiles',$review['profile_picture']).'">
<img id="profile_pict" src="'.self::showPicture('user', $review['username']).'">
</div>
<div id="comment-user">
<div id="reviewer">@'.$review['username'].'</div>
......
<?php
class reviewFormViewer {
public static function viewReviewForm($params) {
$ordered_book = $params['ordered_book'];
......@@ -36,12 +35,20 @@
</div>
<div class="add-flex-direction-column" id="rightbar-pic" align="center">
<div class="flex-1">
<img id="book-pict" src="../images/books_picture/default.jpg">
<img id="book-pict" src="'.self::showPicture($ordered_book['book_id']).'">
</div>
</div>
</div>';
return $str;
}
private function showPicture($input) {
if (fileProcessing::isExistBookImage($input)) {
return fileProcessing::getImageBookPathFromRoot($input);
} else {
return '/images/books_picture/default.jpg';
}
}
private function showReviewForm($order_id, $book_id) {
$str = '
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment