close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Help with a php query

Thread began 6/30/2010 10:45 pm by adromidon | Last modified 7/01/2010 7:50 pm by adromidon | 862 views | 3 replies

adromidon

Help with a php query

Ok so i found this php script online it seems to look like it would work for my purposes but I do not want to type it out for every single image I load

$img = "../pics/thumbs/{$row['part_numbers']}.jpg";
$image_width = getimagesize($img);
if(!getimagesize($img)) // if image does not exist, replace with secondary
{
echo "<td width=\"15%\"><img src=\"slotcars/logos/fly_logo.jpg\"></img>";
}
else{ // everything is ok, load original image
echo "<td width=\"15%\"><img src=\"../pics/thumbs/{$row['part_numbers']}.jpg\"></img>";
}



Here is what I want. The site i use allows images to be uploaded from an popular online tech broadcast. right now it saves all these images localy on the server what I want to do ultimately is have the images saved on an Amazon S3 cloud bucket then when the image loads on the page it polls the S3 buckett for the picture if it does not exist then it pulls it from the local server.

The upload part i am going to work on later right now what i want is a way to check if images exist on the S3bucket using a variation of the script above and if it is not there pull it from the local server. I have the bucket mapped to a subdomain which i will not put here as i do not want to violate the TOS for the forum.

However an example would be image.mysite.com being the subdomain mapped to a S3 buckett and screencaps/ being the folder of the local store

If the above script works then how do i make this a function and store it in an external file so i can just call the function when needed?

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...