Without getting into too much detail, I am using the school server for a website project, which doesn't have the php image libraries installed. So I need something else to use THAT I DO NOT HAVE TO INSTALL. I don't have sudo/admin privileges. I do have gcc/g++ so there's that. I tried other libraries made in php and other languages they all don't work. I think my only option is something like "imagemanip.cpp" -> "g++ imagemainp.cpp -o imagemanip" -> "imagemanip image new_image_name desired_width desired_height"

I did try CImg but I couldn't get it to work and I think I have to install that so that's out of the question.

I'm open to suggestions. I'd like to know any other possibilities before I throw in the towel.

Recommended Answers

All 13 Replies

Do you only want the ability to manipulate images while using any computer (or at school)? Would it be sufficient if you just use an online site to do that? Search Google with "image manipulation online" and you will see many website offer free online for image manipulation. Would that be suffice?

Only if its something that can be run from within a php page or command line. Obviously I can make the thumbnail images on my own computer and then upload but I want something that can dynamically upload and resize images for site functionality.

OK, so what you want is somewhat a software that does not need local authorization (such as java classes). What I think this link and this link may be related to what you want.

Actually that reminds me: I wrote a small java program. It works on my computer (albeit slowly) but it doesn't work at all on the school server:


import java.io.*;
import javax.swing.*;
import javax.imageio.*;
import javax.imageio.ImageIO;
import java.lang.Exception;
import java.io.IOException;
import java.awt.*;
import java.awt.image.*;
class imageResize2
    public static void main(String[] args) throws IOException

        new imageResize2(args);
    public imageResize2(String[] args) throws IOException
    public void resize(String[] args) throws IOException
            BufferedImage image, scaledImage;
            image = (BufferedImage)ImageIO.read(new File(args[0]));
                throw new IOException("Couldn't upload file, make sure name is correct: "+args[0]);
            int w, h;
                w = Integer.parseInt(args[2]);
            catch (NumberFormatException e)
                throw new IOException("Invalid number format for new width");
                h = Integer.parseInt(args[3]);
            catch (NumberFormatException e)
                throw new IOException("Invalid number format for new width");
            scaledImage = new BufferedImage(w,h,image.getType());
            Graphics2D g = scaledImage.createGraphics();
            g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
            ImageIO.write(scaledImage,"jpg",new File(args[1]));
        else {
            throw new IOException("Improper number of arguments. Use: javac imageResize image new_name new_width new_height");

errors on server:

[j.d.dancks@babi shopsite]$ java imageResize2 images/rascal.jpg thumb/rascal-index.jpg 75 75
Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: imageResize2
   at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
   at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.5.0.0)
   at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
   at java.lang.Class.forName(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
   at gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.5.0.0)
   at _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.5.0.0)
   at _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/libgcj.so.5.0.0)
   at __gcj_personality_v0 (/u/students/j/j.d.dancks/public_html/shopsite/java.version=1.4.2)
   at __libc_start_main (/lib/tls/libc-2.3.4.so)
   at _Jv_RegisterClasses (/u/students/j/j.d.dancks/public_html/shopsite/java.version=1.4.2)
Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in [file:/usr/share/java/libgcj-3.4.6.jar, file:./, core:/]
   at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
   at gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
   at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.5.0.0)
   at _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
   at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
   at _Jv_BytecodeVerifier.verify_instructions_0() (/usr/lib/libgcj.so.5.0.0)
   at _Jv_VerifyMethod(_Jv_InterpMethod) (/usr/lib/libgcj.so.5.0.0)
   at _Jv_PrepareClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
   at _Jv_WaitForState(java.lang.Class, int) (/usr/lib/libgcj.so.5.0.0)
   at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
   at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
   ...9 more
[j.d.dancks@babi shopsite]$

I think it might have had something to do with the class calling an instance of itself or something.

Anyway its supposed to work with command line arguments like so:
java imageResize2 image_name new_image_name new_width new_height

You should try compile the class using your school server. Often time, different java compiler (i.e. sun, oracle, etc.) cause the problem.

I thought that would cause a problem. Problem is javac isn't on the server, only java, which may be required for functionality. I'm really starting to think I can only rely on a c/c++ since I have the gcc compiler on there. Do you at least know where I might be able to find a .jpg reader/interpreter or something? uncompiled?

Hmm... try this link and see what you think?

ummm... what with the download mananger? its either that or cp those files?

Huh? I was thinking about those last 2 links at the bottom of the page may be what you can give them a try (download those lib files). They are c files, so you may take them and compile at home to see if it is what you are looking for?

I didn't mean to let this die. This looks like it could work buts its missing a header file "ip.h"

Hmm... Don't know where to find it... :( How about this link instead? It is one of Google Code project.

eeeessshhh. Yeah I can't install anything. I see something about a makefile. If I as a better programmer and I had some more time I would rip a few lines from this or that other thing and make it myself. Its ok I'll just resize with css or javascript or something. If I or someone else finds something that absolutely fits the bill I'll definitely post it. I hate leaving threads like this

I'm sorry for not be able to find the right source for you. :( If I ever come across it, I will also post it here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.