Jump to content

Recommended Posts

Hi all. First time poster. =)

 

I've just finished a website for the university newspaper. It's very snazzy, and I'm proud of myself because it's the first real project that I've ever worked on that involved php/mysql/css/etc. The back end for the website is SMF, but the front end is all custom coded and reasonably gorgeous.

 

However, I've run into one problem: the website must be hosted on the school's servers, and the servers do not have a GD library installed. Thus, I'm missing these two critical functions:

 

I can't resize pictures that are uploaded... so my reporters can upload stories, but when the photographers upload their pictures, they're 10 megapixel, 3 megabyte monsters. I want to resize them down to thumbnails so I can display them next to my stories.

 

I can't do captcha images for the forum. This is lame, because of potential bot registration/posting.

 

But... I have fast web hosting on another server, and that server just so happens to have GD2+PHP. Can I potentially use another server's GD2 library for image manipulation?

 

Thanks so much for your help!

Bump for clarification.

 

All I want to do is this:

 

A user on web site A submits a large photo to site A.

Site A forwards the photo to site B, asking for a resize to thumbnail.

Site B lets site A know when the thumbnails are done, and either sends back links to the thumbnails or sends the thumbnail images themselves.

Site A uploads the thumbnails from site B.

 

Also, this:

 

Site A requests a captcha from site B. Site B responds with the captcha.

 

It's complex. Is it doable? Where do I even begin?

 

Thanks again. Hope someone can help me out.

Perhaps read about cURL if your school server supports that extension.

http://www.php.net/curl

 

Basically open a connection to a page on your server using cURL and POST the uploaded file.

 

e.g.

 

school.edu/reporterupload.php recieves POST data from client.

 

school.edu/reporterupload.php POSTS data to fastserver.com/resize.php and reporterupload.php finishes execution.

 

Then afterwards fastserver.com/resize.php stores a list of the resized images in database. fastserver.com/list.php retrieves this data

 

school.edu runs a cron job (UNIX/Linux) or Scheduled Task (Windows) executing a PHP script on school.edu/getthumbs.php every 5 minutes.

 

getthumbs.php makes a GET request to fastserver.com/list.php and downloads each thumbnail at fastserver.com/download.php?id=imageid and stores it on school.edu/thumbs/ folder.

 

download.php deletes the thumbnail and database field for each image after being viewed.

 

personally, i'd reckon it'd be easier to ask the powers that be to install GD for you (as it's for a university project anyway) explaining that it's not like you're installing Doom or some virus-ridden bit of rubbish or anything.

 

compared to the complexities of getting two servers talking to eachother to do a relatively small task, it's the easiest and only way i'd suggest.

Yup,

 

I definitely agree with redbullmarky and Stopofeger on this one.

 

What I suggested is just a way to do it, however the solution I presented is in many ways ridiculous for most servers as it would require long execution times, high memory, and long wait times.

 

Install GD2, Exif extension or ImageMagick's command line mogrify tool to make it simple and fast.

Thanks for the process description, lightningstrike. I may end up doing something just like that if nothing else works.  :)

 

Unfortunately, the admins are swamped at the moment and may not become unswamped until next semester. However, maybe if I sent them a link to easy installation instructions, they could run with it.

 

Clarification: The server is linux/apache. I don't have much access to the server: no cpanel, no cron jobs, nothing but secure ftp. My account is messed up - I have access to the entire server including all /var, /etc, and so on, so I can read the conf files for Apache if that helps. However, I prefer not to muck about in an area where I shouldn't be.

 

if you don't have GD installed, why don't you install it?

You can use dynamic .so libraries that can be used wiithout having to recompile PHP. Im sure you have access to that server isn't it?

Wow, this sounds promising - I'm very much a newbie when it comes to these sort of things, so bear with me:

 

I gather that I need the admins to add 'extension=php_gd2.so' (or the equivalent library) in the php.conf file. They also need to place php_gd2.so in the modules directory.

 

Where do I download php_gd2.so (I couldn't find it on the server. :()? Will there be different library versions for different versions of php (the school's server is running php 4.3.9)?

 

Thanks so much for all your help. I just need these two questions answered and I might be able to get the admins to set this up for me.

Clarification: The server is linux/apache. I don't have much access to the server: no cpanel, no cron jobs, nothing but secure ftp. My account is messed up - I have access to the entire server including all /var, /etc, and so on, so I can read the conf files for Apache if that helps. However, I prefer not to muck about in an area where I shouldn't be.

 

if you don't have GD installed, why don't you install it?

You can use dynamic .so libraries that can be used wiithout having to recompile PHP. Im sure you have access to that server isn't it?

Wow, this sounds promising - I'm very much a newbie when it comes to these sort of things, so bear with me:

 

I gather that I need the admins to add 'extension=php_gd2.so' (or the equivalent library) in the php.conf file. They also need to place php_gd2.so in the modules directory.

 

Where do I download php_gd2.so (I couldn't find it on the server. :()? Will there be different library versions for different versions of php (the school's server is running php 4.3.9)?

 

Thanks so much for all your help. I just need these two questions answered and I might be able to get the admins to set this up for me.

yes, extension=php_gd2.so will do it, not in php.conf; its php.ini. You will place the .so file in the extension directory specifyed in the php.ini file. Look at it; you will know where to put the file. You can search the web to look for .so libraries. search for "php gd2 shared library/object".

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.