Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,736 members, 7,817,029 topics. Date: Friday, 03 May 2024 at 11:43 PM

Images Not Displaying After Applying Rewrite Rule Htaccess Php - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Images Not Displaying After Applying Rewrite Rule Htaccess Php (843 Views)

Using The .htaccess file to improve your website / Applying For Patent In Nigeria / Displaying Images Horizontally With Php (2) (3) (4)

(1) (Reply) (Go Down)

Images Not Displaying After Applying Rewrite Rule Htaccess Php by Nobody: 12:39pm On Jul 28, 2014
Using the following,
PHP
Mysql
Xampp
Htaccess
Windows 7

Am currently having problem with my image display in php, which I have applied rewrite rule, which is not displaying. All other parts of the design project, on xampp as my server, is working well. This is the code for my file [oop.php] to display image.


<html>
<head>
<link rel="stylesheet" type="text/css" href="rate.css" />
</head>
<body onLoad="setTimeout('delayer()', 25000)">
<?php
session_start();
$idvalue=$_SESSION["value"];
include 'connect.php';

$QuerySelects = "SELECT * FROM bentry where id = '$idvalue' ";

$Query = mysql_query($QuerySelects) or die (mysql_errno() . ": " . mysql_error(). "\n"wink;

$counter = 0;
while($result=mysql_fetch_assoc($Query)) {
$WPICTURE = "<img style=\"width: 50%;\" src='C:/xampp/htdocs/mature/". $result['wpic'] . "' />";
$MPICTURE = "<img style=\"width: 250px;\" src='C:/xampp/htdocs/uploads/". $result['mpic'] . "' />";

echo"
<div class='wDiv'>
<div class=' WPICTURE'>".$WPICTURE."</div>
<div class='WPICTURE'>".$WPICTURE."</div>
</div>";
}
?>
</HTML>


PROBLEM
When I test it as localhost/deployable/oop.php, it displays the images correctly but when I use the rewrite rule option such as www.deployable.com/oop.php; it does not show any image.

In my windows, this is my host file,

127.0.0.1 localhost
127.0.0.1 www.deployable.com

While in xampp, httpd-vhosts is set as this


NameVirtualHost *
<VirtualHost *>
DocumentRoot "c:/xampp/htdocs"
ServerName localhost
</VirtualHost>
DocumentRoot "c:/xampp/htdocs/deployable"
<VirtualHost *>
ServerName www.deployable.com
<Directory "c:/xampp/htdocs/deployable">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


It shows broken image that is displayed when I run oop.php.
Re: Images Not Displaying After Applying Rewrite Rule Htaccess Php by IamGodzilla: 12:51pm On Jul 28, 2014
Check your error logs.to see where the problem might be from.
It might be that the links are broken. When testing with www.deployable.com...
Re: Images Not Displaying After Applying Rewrite Rule Htaccess Php by Nobody: 12:58pm On Jul 28, 2014
IamGodzilla: Check your error logs.to see where the problem might be from.
It might be that the links are broken. When testing with www.deployable.com...
OK will just check that and get back thanks.
Re: Images Not Displaying After Applying Rewrite Rule Htaccess Php by Nobody: 7:35pm On Jul 28, 2014
@iamgodzilla

Thanks for that suggestion, it has helped.
Instead of this,
$MPICTURE = "<img style=\"width: 250px;\" src='C:/xampp/htdocs/uploads/". $result['mpic'] . "' />";

I changed it to,
$MPICTURE = "<img style=\"width: 250px;\" src='C:/xampp/htdocs/". $result['mpic'] . "' />";

After checking then error log. Now its working.

PROBLEM 2
now I want to remove the white background of the image before sending it to the folder "uploads". Thanks

1 Like

Re: Images Not Displaying After Applying Rewrite Rule Htaccess Php by IamGodzilla: 10:14pm On Jul 28, 2014
hisblud: @iamgodzilla

Thanks for that suggestion, it has helped.
Instead of this,
$MPICTURE = "<img style=\"width: 250px;\" src='C:/xampp/htdocs/uploads/". $result['mpic'] . "' />";

I changed it to,
$MPICTURE = "<img style=\"width: 250px;\" src='C:/xampp/htdocs/". $result['mpic'] . "' />";

After checking then error log. Now its working.

PROBLEM 2
now I want to remove the white background of the image before sending it to the folder "uploads". Thanks

Your Welcome.
Well, i doubt if php can do that 100%, but you can get more details on google. by searching about image upload and format editing

(1) (Reply)

How To Runs Code And Project ? / Site Not Opening On Opera Why? / Joomla Mobile View

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 18
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.