473,804 Members | 3,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

php image resizing script (PHP Thumbnailer) is not working

245 New Member
Hey geeks,
I am using a script PHP Thumbnailer which resize image at run time. But it is not working in my case as i have integrated that script by studying it's documentation.

Here is the URL where i am using his script.
My URL

and here is the script code i am using in my application
Expand|Select|Wrap|Line Numbers
  1. <img src="show_image.php?file=show_image.php?file=images%2Fproducts%2F1246358928.gif" />
and the how_image.php file has the following code
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. error_reporting(E_ALL);
  3. require_once 'lib/ThumbLib.inc.php';
  4. $fileName = (isset($_GET['file'])) ? urldecode($_GET['file']) : null;
  5. if ($fileName h3. null || !file_exists($fileName)){
  6.      // handle missing images however you want... perhaps show a default image??  Up to you...
  7. }
  8. try{
  9.     $thumb = PhpThumbFactory::create($fileName);
  10. }
  11. catch (Exception $e){
  12.     // handle error here however you'd like
  13. }
  14. $thumb->resize(100, 100);
  15. $thumb->show();
  16. ?>
  17.  

and here is the URL from where i read this script help
SCRIPT HELP URL

it has heading name "Showing Images" which tells hwo to resize image dynamically.

Kindly help me to sort out my problem.


kind regards,
Mohsin Rafique
Dec 20 '09 #1
9 4026
Dormilich
8,658 Recognized Expert Moderator Expert
$fileName h3. null
that’s a rather strange condition… and I’m not a geek.

It would be helpful, if you could describe the error, for I don’t have ‘Bock’ to search for it at length.

and another thing, usually you handle errors when the exception is thrown and not before (that’s what the catch block is for)
Dec 20 '09 #2
neovantage
245 New Member
Sir Dormilich,
The problem is i am not getting error but it does also not showing the picture after resizing too. So what will be the problem then? Picture does exist too at that that path too.
Dec 21 '09 #3
Dormilich
8,658 Recognized Expert Moderator Expert
what image? I don’t see any image worth thumbnailing.
Dec 21 '09 #4
neovantage
245 New Member
Pleas find the attached screenshot which shows the location of image not display in the page after using resizing script.

Again this is the Live URL

Also see in IE. Then you will find a cross icon image not displaying
Attached Images
File Type: jpg IMAGE-NOT-Showing.jpg (15.4 KB, 194 views)
Dec 21 '09 #5
Dormilich
8,658 Recognized Expert Moderator Expert
Also see in IE. Then you will find a cross icon image not displaying
I can’t do that.
Dec 21 '09 #6
neovantage
245 New Member
Should i give you my php script....?
Dec 21 '09 #7
Dormilich
8,658 Recognized Expert Moderator Expert
maybe after I can reproduce the error (which is right now the problem).
Dec 21 '09 #8
neovantage
245 New Member
Sorry it works now. it was my fault
.
My image was save with the extention *.png and it was taking it as *.gif that is why it is nto showing the image. Thank you very much "Dormilich" . I am really very grateful to you.
Dec 21 '09 #9
Dormilich
8,658 Recognized Expert Moderator Expert
you may have realized it earlier, if you would have checked the catch block.

a very simple example how to use Exceptions:
Expand|Select|Wrap|Line Numbers
  1. try {
  2.     $thumb = PhpThumbFactory::create($fileName);
  3. }
  4. catch (Exception $e) {
  5.     // e.g. print the error message
  6.     echo $e->getMessage();
  7. }
of cause you don’t need to print the message, you can also let a mail script send the message to you.
Dec 21 '09 #10

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

Similar topics

6
2622
by: Mr WZ Boson | last post by:
Hello, I hope you can help - I'm a bit new to PHP. My basic problem is with a page (HTML) which is intended to display an image slideshow. On this page there are a number of links to click (one for each slideshow topic) and a "TV screen" to view the results. The images are stored on the server as (big) JPG files - and when they are downloaded for the slideshow, I resize them with a PHP script
0
1805
by: doffer | last post by:
I want to make a portfoliosystem where user can register and get their own portfolio... I've started the developer work, but I'm stuck on the image upload part... I'm experiencing some problems getting the picture resized and thumbnailed... I'm on a apache server running php 5 with 8MB php_memory. When uploading, the script works fine most times when uploading small files (below 100kb and sometimes up close to 300kb too), but when...
5
4732
by: Jim | last post by:
I've heard that resizing images through PHP (either GD2 or ImageMagick) is a processor intensive exercise. I'm setting up a site where users will be uploading up to 10 images along with the details of their product. For each image uploaded (max 500Kb), I'll be resizing it to create a small, medium and large version after which I'll discard the original. My worry is that as the site becomes more popular, the processor time spent resizing...
8
3693
by: berkshire | last post by:
Hi, Anyone know of a script out there that can resize images and not sacrifice image quality? I've been using phpthumb (http://phpthumb.sourceforge.net/) but when compared to an image resized in photoshop it's products are not as good (yeah I upped the image quality and tried out some filters - no luck). Tutorials or scripts online preferred are preferred, but if you know of a way to change the settings on phpthumb to maintain the...
9
4424
by: tshad | last post by:
Is there a way to display images (imageButtons or linkbuttons for instance) as a max size (200px by 50px) and not have it stretch the image? What I want to be able to do is limit the real estate an image can take up but not stretch the image if it happens to be 150px by 40. I am doing commands such as: <asp:ImageButton ID="CompanyLogo" onClick="Image_Click" Width="200px" Height="50px" runat="server"/>
7
17060
by: mishrarajesh44 | last post by:
hii all Truly telling i hav got this code from net & i am finding error while running the code below.. code:- <?php $idir = "photo/"; // Path To Images Directory $tdir = "photo/thumbs/"; // Path To Thumbnails Directory $twidth = "125"; // Maximum Width For Thumbnail Images
10
7082
by: mishrarajesh44 | last post by:
hii all, I am facing a problem currently.. i have a script for image uploading and resizing.. the image uploading takes place properly for every size images.. but, the resizing works for only small sized iamages.. for eg. resizing takes place for 70 kb sized images but fails for 600kb or more.. my code is below..
5
3454
by: Michael | last post by:
Hello all, how could I rotate a server side image in asp.net and show it in web page? Thanks.
14
3732
anfetienne
by: anfetienne | last post by:
hi.....i have this script (below #1) that is linked to another php file SimpleImage.php (#2) im trying to get it to work on my uploaded images but it keeps coming up errors.....i haven't altered anything except for: $image->load('picture.jpg'); $image->resize(546,403); $image->save('picture2.jpg'); I put the variables i need in there within " " instead of ' ' and i always get a error message.....am i doing something or cant...
0
9705
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
9575
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
10320
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
9134
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
7609
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
6846
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
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...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.