Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5948293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:05:12+00:00 2026-05-22T17:05:12+00:00

I am hoping that someone can help me: I have this scripts that if

  • 0

I am hoping that someone can help me: I have this scripts that if a file does not exists on my server, it goes to a remote server to check for the file. If the file exists it copies it to my local server, and does not check it again. So the Imagick part only works when the image does not exists on my local server.

The problem that I have is that if the file does not exists on the remote server – then the application throughs a error – Here is the code of my script:

        <?php if (file_exists($filename))
    {
echo '<img src="'.$imageurl1.'" width="'.$g_sites_img1.'" alt="'.$imageurlmeta.'" class="image1" align="left" />';
    }
else { $imageurlfolder = dirname($filename); 
@mkdir($imageurlfolder, 0755, true);
@copy($imgremoteurl, $filename);
$thumb = new Imagick($filename); 
$thumb->scaleImage($g_sites_img1, 0);
$thumb->writeImage($filename);
$thumb->destroy(); }?>

Here is the error code:

> Fatal error: Uncaught exception
> 'ImagickException' with message
> 'Unable to read the file:
> /home/game1/public_html/images/small///.jpg'
> in
> /home/game1/public_html/includes/standard__1.php:15
> Stack trace: #0
> /home/game1/public_html/includes/standard__1.php(15):
> Imagick->__construct('/home/game1/pub...')
> #1 /home/game1/public_html/includes/news.php(127):
> require('/home/game1/pub...') #2
> /home/game1/public_html/index1.php(126):
> include('/home/game1/pub...') #3
> {main} thrown in
> /home/game1/public_html/includes/standard__1.php
> on line 15

How can I avoid this error but still make the page load normally?

I have tried error_reporting(0); <— This stops the page from completely loading once the error has occured.

Any ideas would be appreciated.

I have found the solution with all the answers posted! thanks a million

<?php if(file_exists($filename))

{ echo ”; }
else { try {$imageurlfolder = dirname($filename);
@mkdir($imageurlfolder, 0755, true); @copy($imgremoteurl, $filename);
$thumb = new Imagick($filename);
$thumb->scaleImage($g_sites_img1, 0); $thumb->writeImage($filename);
$thumb->destroy();}
catch (ImagickException $e) {
echo “Exception caught!\n”;
}
}
?>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:05:13+00:00Added an answer on May 22, 2026 at 5:05 pm

    Well, you should catch the exception, don’t try ignoring the errors. After all, you are getting fatal error which prevents further logic from being executed.

    try
    {
        // your logic
    }
    catch ( ImagickException $e )
    {
        // do something with it
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am hoping that someone can help me. I have found this jquery script
I'm really hoping that someone can help. I have tomorrow to get this right
I am hoping that someone can help me with this regex, I need to
This is bizarre, but I am hoping someone can help me out. I have
I am hoping that someone can help me answer this question. I am writing
I am hoping that someone can help me with this relative simple problem: <?php
I have a weird problem that I am hoping someone can help me with.
Hi There I am hoping that someone can help me with this visualscript filesystemobject
I am hoping that there is someone that can help me with this question.
Hoping someone can help me out with this. Lets say I have a table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.