Lookin to Hire a developer

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jjaslow

Lookin to Hire a developer

Post by jjaslow »

I have an online tool (written in PHP, using Imagemagick and Flash) which recently stopped working properly. The original developer is unavailable, so I am looking for someone to help me fix it. I may also use this opportunity to improve the tool. More info to follow, but basically, the tool used to accept images in jpg, tif and bmp but now only accepts jpegs. Not sure why it broke. I recently added a Google tracking code to the pages - maybe that broke it, or maybe the host messed something up. Either way I need help.
immortal26

Re: Lookin to Hire a developer

Post by immortal26 »

Well let's try and prevent you from having to spend money.

First, Is the upload form itself in flash or html?
Second do you know how to access the code?

If you can at least do the Second .. (accessing the code) we might be able to assist you).

Since this is ImageMagick forums though... I don't think it would be an ImageMagick problem, but none the less this sounds like an easy solution, so just let us know.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Lookin to Hire a developer

Post by snibgo »

... but now only accepts jpegs.
Do you get any error messages? What signs tell you that BMP and TIF are no longer accepted? Some diagnostics may be needed even to find this out.

Is the server under your control, i.e. can you decide what software packages are installed?

Is the Flash MXML or ActionScript?

What country are you in? (If the USA, you might not want to employ sopmeone in Outer Mongolia. Or vice versa.)

The uploading process is likely to be PHP or HTML (possibly with Javascript), or perhaps Flash, but in any case is unlikely to fail only on certain file types.
snibgo's IM pages: im.snibgo.com
jjaslow

Re: Lookin to Hire a developer

Post by jjaslow »

Thanks for responding. So you know where I am coming from, I know enough about the programming to be dangerous, but not enough to do anything useful. I do have the php code and will attach the relevant lines of code below. I use Dreamweaver to make changes to the pages and upload via FTP.

To answer the questions...
The uploader is a simple HTML POST, but one of the improvements I would like to do is make it a Flash uploader. I want the user to be able to see a progress bar and time estimate.

To clarify, the UPLOADING is working properly. its what my app does with the files that is broken. The tool is designed to only use jpeg, but we first use Imagemagick to convert tif and bmp to jpeg for the tool. That conversion is not working, so if the tool doesnt get a jpeg, it cant move forward,.

I have access to the server but dont personally have the skills to get into the command line to test the imagemagick directly. Yes, I can install any applications on the server. In fact, the host includes Imagemagick as a std application, but we installed a newer version that had more features.

I know it doesnt work because my application tests the file to see if its a jpeg, tif or bmp and warns otherwise. A tif used to continue successfully but now it goes to an error page that tells the user its not a jpeg/tif/bmp.

I dont know about the Flash, but the error occurs way before the Flash part comes into play.

And oh, Im in New Jersey.



Here is the lines of code that look for a tif or bmp and convert to jpeg

if (exif_imagetype($fname) == IMAGETYPE_BMP ||
exif_imagetype($fname) == IMAGETYPE_TIFF_II ||
exif_imagetype($fname) == IMAGETYPE_TIFF_MM) {
$path_parts = pathinfo($fname);
list($path_parts['filename']) = explode(".", $path_parts['basename']);
$exec = "convert \"".$fname."\" \"".$path_parts['dirname']."/".$path_parts['filename']."_".$path_parts['extension'].".jpg\"";
exec($exec, $yaks);
$fname = $path_parts['dirname']."/".$path_parts['filename']."_".$path_parts['extension'].".jpg";//change fname to new jpg
//resize($path_parts['dirname']."/".$path_parts['filename']."_".$path_parts['extension'].".jpg");
resize($fname);
}elseif((exif_imagetype($fname) == IMAGETYPE_JPEG) || (exif_imagetype($fname) == IMAGETYPE_PNG)){
resize($fname);

}
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Lookin to Hire a developer

Post by snibgo »

I'm in the UK, so can't help with the general application upgrade.


The code looks as if it should work, but:
1. Inefficient: exif_imagetype will open and close the file three times in the initial "if"
2. Converting to a jpeg, then resizing that jpeg, will degrade quality unnecessarily. Better to do this in a single operation.
3. It doesn't test that the exec has actually happened without errors.

You say jpegs work: so they are resized, as shown in the code?

And you say ImageMagick has been upgraded? I suspect PHP can't find it anymore, so the exec fails. The code will continue past where you have quoted, with $fname taking the value with extension "jpg". But that file doesn't exist.

Does this make sense? Is it consistent with what happens next?
snibgo's IM pages: im.snibgo.com
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Lookin to Hire a developer

Post by Bonzo »

I wouldn't think the problem is with ImageMagick.

This first part checks for a bmp or tiff which I suspect is the problem

Code: Select all

if (exif_imagetype($fname) == IMAGETYPE_BMP || 
exif_imagetype($fname) == IMAGETYPE_TIFF_II || 
exif_imagetype($fname) == IMAGETYPE_TIFF_MM) {
$path_parts = pathinfo($fname);
list($path_parts['filename']) = explode(".", $path_parts['basename']);
$exec = "convert \"".$fname."\" \"".$path_parts['dirname']."/".$path_parts['filename']."_".$path_parts['extension'].".jpg\"";
exec($exec, $yaks);
$fname = $path_parts['dirname']."/".$path_parts['filename']."_".$path_parts['extension'].".jpg";//change fname to new jpg
//resize($path_parts['dirname']."/".$path_parts['filename']."_".$path_parts['extension'].".jpg");
resize($fname);
This part checks for a jpg which is working

Code: Select all

}elseif((exif_imagetype($fname) == IMAGETYPE_JPEG) || (exif_imagetype($fname) == IMAGETYPE_PNG)){
resize($fname);
What do you get from this when you directly upload this code and try with different image types?

Code: Select all

<?php
// Change the file names to the uploaded image names
$fname = array('image.jpg', 'image.bmp', 'image.tiff', 'image.png');

// Print the file type
foreach( $fname as $value ){
if ( exif_imagetype( $value ) == IMAGETYPE_BMP ) { echo $value." is a BMP file <br>"; }
elseif ( exif_imagetype($value) == IMAGETYPE_TIFF_II ) { echo $value." is a TIFF II file <br>"; }
elseif ( exif_imagetype($value) == IMAGETYPE_TIFF_MM ) { echo $value." is a TIFF MM file <br>"; }
elseif ( exif_imagetype($value) == IMAGETYPE_JPEG ) { echo $value." is a JPEG file <br>"; }
elseif ( exif_imagetype($value) == IMAGETYPE_PNG ) { echo $value." is a PNG file <br>"; }
else { echo "<br>The file type is not on the allowed list"; }
}
?>
The first part of code seems a bit complicated and you can combine it all into one as you do not need an intermediate jpg file.
Why do you find all the path parts for bmp and tiff but do not need to for jpg and png ?

Code: Select all

if (
exif_imagetype($fname) == IMAGETYPE_BMP || 
exif_imagetype($fname) == IMAGETYPE_TIFF_II || 
exif_imagetype($fname) == IMAGETYPE_TIFF_MM ||
exif_imagetype($fname) == IMAGETYPE_JPEG ||
exif_imagetype($fname) == IMAGETYPE_PNG )
{
resize($fname);
}

else { echo "Unsupported file type"; }
jjaslow

Re: Lookin to Hire a developer

Post by jjaslow »

Thanks again. You are all asking me great questions about how the tool works and why it was designed like it was, but Im not the developer, so I dont really have all those answers. All I know is that I paid for a tool to be designed and it worked as speced but now it doesnt. Here is what I do know...


After the conversion and resize takes place, the image goes into a flash app for the user to work on it. I assume the original developer does the conversion and resizing to make the flash tool work faster.

The fact that the image is converted to jpeg multiple times is not really important, as the flash tool is just a representation of the final layout. On the backend we actually take the original file and bring it into photoshop and do the work by hand. We use the tool as a guideline only.

I see the code suggestions and tried to upload it, but dont see anything useful - probably b/c Im not in the command line interface (dont know how to do that).

FYI, You can see the application at:
http://mimosadigital.com/nechsi2/login.php?type=205
jjaslow

Re: Lookin to Hire a developer

Post by jjaslow »

If anyone is interested in the job, please let me know.
Post Reply