I'm trying to resize an image with the gd library and am having some
difficulty. Here's my code:
<?php
$img = 'http://upload.wikimedi a.org/wikipedia/commons/e/e3/Kheops-
Pyramid.jpg';
list($width, $height) = getimagesize($i mg);
$img = imagecreatefrom jpeg($img);
$temp = imagecreate(500 , 500);
imagecopyresize d($img, $temp, 0, 0, 0, 0, 500, 500, $width, $height);
header('Content-type: image/jpeg');
imagejpeg($temp );
?>
All I get is a 500x500 black picture. What I don't get is a resized
wikimedia.org picture. Any ideas as to what I'm doing wrong? 1 1632
On Nov 19, 8:06 pm, ljb <lba...@pobox.c om.nospamwrote:
terra1...@yahoo .com wrote:
I'm trying to resize an image with the gd library and am having some
difficulty. Here's my code:
<?php
$img = 'http://upload.wikimedi a.org/wikipedia/commons/e/e3/Kheops-
Pyramid.jpg';
list($width, $height) = getimagesize($i mg);
$img = imagecreatefrom jpeg($img);
$temp = imagecreate(500 , 500);
imagecopyresize d($img, $temp, 0, 0, 0, 0, 500, 500, $width, $height);
header('Content-type: image/jpeg');
imagejpeg($temp );
?>
All I get is a 500x500 black picture. What I don't get is a resized
wikimedia.org picture. Any ideas as to what I'm doing wrong?
Check usage on imagecopyresize d. I think you switched source and
destination, i.e. you copied your fresh blank image over onto the pyramid
image.
That was it - thanks! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Alex Hopson |
last post by:
I'm using the code below to loop through some images and resize each image
twice, once to create a thumbnail and once to create a small image.
The page stops loading around the 38th image out of 40+. Not always the same
place but it's either 38th or 39th image, which I find strange as it's not
consistent.
At first I thought it was a timeout problem so I added - set_time_limit(0);
and ignore_user_abort (true); to prevent it timing out,...
|
by: Clyde Ellul |
last post by:
Hi there.
I need to write a simple program that reads a GIF image from an input
stream, resizes it, then writes it back to an output stream in the
same format (GIF). (JPEG input/output is good too, but GIF is
preferrable). JAI can do this sort of but can't write to GIF format.
Also, it looks too complicated for what I need; I'm a bit in a
hurry...
Is there a simple way of doing what I want? Is there a free,
|
by: Ron Vecchi |
last post by:
I am using asp.net to upload an image and then perform resizing on it and
saving the different sizes to file.
The resized images were coming up and being displayed in the bowser fine but
the image sizes are a lot bigger(in file size) than the actual image being
uploaded.
The actual image being uploaded was around 22000bytes
The smaller resized image is 120000bytes
Also on the web when the resized image is displayed it starts out with a...
|
by: Koen Hoorelbeke |
last post by:
Hi there,
I want to read a jpg-file from a url (f.e. http://someserverWhichIsNOTLocal/images/test.jpg), get the dimensions, resize it, save it to my local disk on the webserver as a gif-image and next show it on my own (mobile) pages. (Actually I'm reading some images from my normal website, which is on another machine, resize them, and show them on my mobile site ...).
The main problem lies in reading the image from a url ... can't seem...
|
by: neverstill |
last post by:
hi-
So I wrote this nice little page that will allow the managers to add images
to the products table. Without too many details to confuse everything,
basically what I'm doing is:
getting an Image
from there I'm creating a new Bitmap(Image, int w, int h);
then I'm saving that bitmap various encoder quality values.
| |
by: David W. Simmonds |
last post by:
I have a DataList control that has an Image control in the ItemTemplate. I
would like to resize the image that goes into that control. I have a series
of jpg files that are full size, full resolution (ie. large). I have a
database that contains references to the pictures. Currently I have to
resize the jpgs manually, and then point the ImageUrl property at that jpg
using databinding. This works fine. I would like to avoid the resizing step...
|
by: Tuvas |
last post by:
I am seeking a way to resize a PIL image, even if the original is a
smaller dimention than the new size. Resizing seems to only make an
image smaller, and not larger. I have a 700x700 sized picture,
sometimes that will display an image larger and other times smaller. Is
there an easy way to do this, a command that I am missing from the
library? Thanks!
|
by: tomasio |
last post by:
Dear NG,
years have passed and I am still more designer than programmer. I
build a new version of my website which has a few nasty bugs,
especially on my startpage: Resizing text brakes the dotted lines
which I use as visual border on the left and right edge of the page
layout and thus produces an unwanted white gap above the enlarged
text. Viewing the page with IE shows this behaviour even without
changing the font size.
|
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..
|
by: brahmaforces |
last post by:
Hi Folks,
I am using cherrypy and python. I am trying to get a user profile
image to resize on the client side before uploading to the server. PHP
has a gd library that does it it seems. Has anyone done this in a
python environment without uploading to the server?
|
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...
| |
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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();...
|
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...
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |