473,800 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

failed to open stream error in php

4 New Member
My php program to resize an jpeg image is as follows,

?php
// File and new size

$filename = '\bala\testPHP\ Lavanya\Kids2.j peg';
//$filename = 'Kids2.jpeg';
$percent = 0.5;

// Content type
//header('Content-type: image/jpeg');

// Get new sizes
list($width, $height) = @getimagesize($ filename);
echo getimagesize($f ilename);

$newwidth = $width * $percent;
$newheight = $height * $percent;

echo "step";

// Load
//$thumb = imagecreatetrue color($newwidth , $newheight);
//echo "1 step";
$source= @imagecreatefro mjpeg($filename );
$textcolor = imagecoloralloc ate($source, 0, 0, 255);
imagestring($so urce, 1, 5, 5, "Error loading $imgname",$text color);
//$source = imagecreatefrom jpeg($filename) ;
echo "2 step";

// Resize
imagecopyresize d($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

// Output
imagejpeg($thum b);
echo "successful ly completed";
?>

it returns the following error

getimagesize(\b ala\testPHP\Lav anya\Kids2.jpeg ): failed to open stream: No such file or directory in /home/bcns/public_html/bala/testPHP/Lavanya/imageprocess.ph p on line 13
step
Feb 1 '07 #1
1 3018
Motoma
3,237 Recognized Expert Specialist
My php program to resize an jpeg image is as follows,

?php
// File and new size

$filename = '\bala\testPHP\ Lavanya\Kids2.j peg';
//$filename = 'Kids2.jpeg';
$percent = 0.5;

// Content type
//header('Content-type: image/jpeg');

// Get new sizes
list($width, $height) = @getimagesize($ filename);
echo getimagesize($f ilename);

$newwidth = $width * $percent;
$newheight = $height * $percent;

echo "step";

// Load
//$thumb = imagecreatetrue color($newwidth , $newheight);
//echo "1 step";
$source= @imagecreatefro mjpeg($filename );
$textcolor = imagecoloralloc ate($source, 0, 0, 255);
imagestring($so urce, 1, 5, 5, "Error loading $imgname",$text color);
//$source = imagecreatefrom jpeg($filename) ;
echo "2 step";

// Resize
imagecopyresize d($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

// Output
imagejpeg($thum b);
echo "successful ly completed";
?>

it returns the following error

getimagesize(\b ala\testPHP\Lav anya\Kids2.jpeg ): failed to open stream: No such file or directory in /home/bcns/public_html/bala/testPHP/Lavanya/imageprocess.ph p on line 13
step

The slashes '\' are in the wrong direction for your filename. They should be '/'.
[PHP]
$filename = '/bala/testPHP/Lavanya/Kids2.jpeg';
[/PHP]
Feb 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
2194
by: One | last post by:
I have a main.php file that calls a php navigation menu. I want to pass the menu file a parameter to tell it which menu to display. Inside the main.php I have : include "/home/ottadca1/public_html/includes/leftnav.php?menuid=dave"; But the error is : Warning:
1
4702
by: kencana | last post by:
Hi all, I was wondering why I always get "failed to open stream: HTTP request failed!" error in either loading a normal or xml file. i don't understand why i can't get the whole result. the result i get is only some part of the respective url (the one i tried to load). The following is my php code to open the file: $file=...
16
2246
by: Gary Wessle | last post by:
Hi please help with this. std::fstream iofs( f.c_str(), std::ios::in|std::ios::out ); std::cout << f << '\n' << iofs.is_open() << std::endl; puts out **************************************************************** pair_status/myPair
2
14086
by: simbarashe | last post by:
Hie I'm trying to pass variables between pages using URLs however I am encountering the following error when I do so: Warning: main(jobSheetDisplay.php?id=20071403PB136CoA) : failed to open stream: No such file or directory in /home/computio/public_html/gto/index.php on line 43 Warning: main() : Failed opening 'jobSheetDisplay.php?id=20071403PB136CoA' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in...
0
2495
by: prasenjit2007 | last post by:
I have a main form for inputing the (to/from/mesg/file) with the following code:- <html> <body> <table> <tr> <td>To:</td> <td><input type="text" name="to" size="50" value="pras_sandilya@rediffmail.com"></td> </tr>
5
3279
by: xieliwei | last post by:
I have a freshly installed openSuSe 10.2 with PHP4 from http://download.opensuse.org/repositories/home:/michal-m:/php4/openSUSE_10.2/ (openSuSe abandoned PHP4 since version 10, but I have customers who need php4 support) The version strings are as follows: # uname -a Linux server2 2.6.18.2-34-default #1 SMP Mon Nov 27 11:46:27 UTC 2006 i686 athlon i386 GNU/Linux
6
62771
by: Andy2500 | last post by:
Hi, I'd like to upload an image to a folder, then I have 3 diffrents examples but all of them give an error "failed to open stream: Permission denied", althrough the C:\Inetpub\wwwroot is not protected. Any suggestions would be helpful, thank you for your time.
2
2486
by: swethak | last post by:
Hi, when i run my code it gives error as fopen(lib/providers//provider.RVLogic.php): failed to open stream: Permission denied in F:\Facebook\furniture11\Data Mining\public_html\lib\inc\functions.lib.php Line 673 : trigger_error("Failed to open stream to $filename. Permission denied!", E_USER_ERROR); could you plz tell the solution for how to avoid that errors
5
9100
by: tyakimov | last post by:
Hi guys I got a problem On my IIS server I changed the password for the Internet Guest Account 'IUSR_Machine' and suddenly the PHP part of the intranet stopped working. - '... failed to open stream: HTTP request failed! HTTP/1.1 401 Access Denied in ...' My PHP script is very simple: <?php
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10275
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.