473,554 Members | 2,307 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[Urgent] Converting an Non-JPEG Image to JPEG

Hi All,

I want to write a PHP webpage which allows people to upload images (no
matter what formats) to me and at the same time converts any non-jpeg
image to JPEG.

Here's what I have:

$FileDest = "/uploads/1.gif";
if (!move_uploaded _file($_FILES["file"]["tmp_name"], $FileDest)):
$Error = "Yes";
endif; // This will upload an image to /uploads/1.gif

$V2_MagickComma nd = "mogrify -format JPEG ".$FileDest ;
exec($V2_Magick Command); // I tried to use this to convert the image's
format (gif) to JPEG but this doesn't work.

$FileDest2 = "/uploads/1.jpeg";
$V2_MagickComma nd2 = "convert ".$FileDest ." ".$FileDest 2;
exec($V2_Magick Command2); // I also tried to use this to convert the
image's format (gif) to JPEG but this doesn't work, either.

What seems to be wrong? How do I modify my codes to make my uploading
webpage to work?

Any idea is appreciated!
Jul 17 '05 #1
3 2650
*** Ming wrote/escribió (20 Apr 2004 02:22:57 -0700):
I want to write a PHP webpage which allows people to upload images (no
matter what formats) to me and at the same time converts any non-jpeg
image to JPEG.


Some ideas I can think of:

1) You check whether file was uploaded successfully. Then you proceed in
either case.

2) You process all files, even JPEG or Excel ones. You should check
$_FILES['file']['type']

3) Print the command line passed to mogrify to see what it looks like, just
to make sure there aren't simple syntax typos.
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #2
Alvaro G Vicario <al************ ******@telecomp uteronline.com> wrote in message news:<13******* *************** ********@40tude .net>...
*** Ming wrote/escribió (20 Apr 2004 02:22:57 -0700):
I want to write a PHP webpage which allows people to upload images (no
matter what formats) to me and at the same time converts any non-jpeg
image to JPEG.


Some ideas I can think of:

1) You check whether file was uploaded successfully. Then you proceed in
either case.

2) You process all files, even JPEG or Excel ones. You should check
$_FILES['file']['type']

3) Print the command line passed to mogrify to see what it looks like, just
to make sure there aren't simple syntax typos.
--


Some Explanation:

When I tried to convert an image to JPEG (for example, pic.gif to
pic.jpeg), I would get pic.jpeg.0, pic.jpeg.1, pic.jpeg.2, pic.jpeg.3,
pic.jpeg.4, pic.jpeg.5 instead of simply "pic.jpeg".

I don't know why. Any help?
Jul 17 '05 #3
Ming wrote:
Some Explanation:

When I tried to convert an image to JPEG (for example, pic.gif to
pic.jpeg), I would get pic.jpeg.0, pic.jpeg.1, pic.jpeg.2, pic.jpeg.3,
pic.jpeg.4, pic.jpeg.5 instead of simply "pic.jpeg".

I don't know why. Any help?


Was it an animated GIF? could those be each frame of the animation?

Use Image Magick from the command line to first be sure that it is
working as expected. Once that is figured out, then start putting pieces
in your PHP script.

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
SEO Competition League: http://seo.koivi.com/
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5978
by: js | last post by:
Hi all, I currently encounter a problem and it is urgent to me. After calling the MsgBox.Show(), the message box is shown with non-modal mode, what is the possible reason??? This only happen in the VB project, works fine in C# project. SystemModal and ApplicationModal MsgBoxStyle were all tried and there was no help.
1
1265
by: Kathy | last post by:
Hi All I have a problem - I have an visual basic application that I am currently converting to .Net - I have a very necessary function that disconnects users from files on a specific network drive I was using the following API's NetFileEnum (enumerates through the files so that I can find the session of the specific file I want to...
4
5893
by: Vittorio Pavesi | last post by:
Hello, I'm using CDO in my VB Application. Does anybody know how to set the Mail priority (Urgent, Medium, Low) ?? Thanks Vittorio ---------------------------------------------------------------------------- -------------------------------- Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
6
1734
by: DraguVaso | last post by:
Hi, I have files I need to read, which contains records with a variable lenght. What I need to do is Copy a Part of such a File to a new File, based on the a Begin- and End-record. I used this functions: Dim intMyFile As Integer = FreeFile() FileOpen(intMyFile, MakePathFile(strDirS, strFileS), OpenMode.Input, OpenAccess.Read,...
3
2466
by: Parvesh | last post by:
hi, I am using a webservice which Returns the Result in an XML string, The XML response i get i svery cumbersome to parse, But if i could convert it to the Corresponding Class using the System.Xml.Serialization, i think that can solve my problem. But i tried using the Deserialize method for converting the XML to the Corresponding Object,...
7
7228
by: zeyais | last post by:
Here is my HTML: <style> ..leftcolumn{float:left;width:300px;border: 1px solid #ccc} ..rtcolumn{float:left;width:600px;border: 1px solid #ccc} </style> <body> <div class="leftcolumn" id="d_links"> multiple <a href="hello.aspx?q=something">something</a><a href="hello.aspx?q=something1">something1</a><a
0
1252
by: Carlos Lozano | last post by:
Hello, I am converting a MS Access application into ASP.NET. It has a many CR reports that calls external functions in a VBA library. I have been trying to create a user Function Library (UFL) in VB.NET to replace the VBA library to minimize the changes to the reports. I am facing two problems: 1) The UFL works okay within CR Designer...
3
6442
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from the socket is missing the last character (line feed). When the same text is sent without the urgent flag set, all of the characters are read. ...
77
3805
by: Hans Schneider | last post by:
1. in the prg bellow what vars are stored on stack, heap, data segment? int i; void main() { int j; int *k = (void *)malloc(1); }
5
6383
by: raghavendrap | last post by:
$tmp = 0xc0211082; $tmp1 = 0xc0000082; Hello friends, I got doubt when i am converting negative hexadecimal to a decimal number.Please look at mentioned example below. In the below example my question is when i am converting an hexadecimal to an decimal number i am getting integer overflow in...
0
7536
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...
0
7814
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8053
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...
0
7895
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...
0
6163
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...
1
5443
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...
0
3583
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...
1
2027
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
0
853
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...

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.